/* iwait-ng (ibindran) — lightweight responsive stylesheet (zero build step) */
:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-muted: #f8fafc;
  --border: #e2e8f0;
  --text: #1e293b;
  --text-muted: #64748b;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-soft: #eef2ff;
  --success: #15803d;
  --success-bg: #dcfce7;
  --danger: #b91c1c;
  --danger-bg: #fee2e2;
  --warn: #b45309;
  --warn-bg: #fef3c7;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.04);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
[x-cloak] { display: none !important; }

/* Topbar */
.topbar {
  background: #1e1b4b;
  color: #fff;
  padding: 0.75rem 1.25rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.18);
}
.topbar-brand { display: flex; align-items: center; gap: 0.75rem; }
.topbar-title { font-size: 1.1rem; font-weight: 700; color: #fff; }
.topbar-sub { font-size: 0.82rem; color: #c7d2fe; }
.topbar-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.topbar-nav a, .topbar-nav button {
  color: #e0e7ff;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  padding: 0.4rem 0.75rem;
  font-size: 0.88rem;
  cursor: pointer;
  text-decoration: none;
}
.topbar-nav a:hover, .topbar-nav button:hover { background: rgba(255, 255, 255, 0.18); }
.topbar-nav a.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Layout */
.container { max-width: 1280px; margin: 0 auto; padding: 1.25rem; }
.stack { display: flex; flex-direction: column; gap: 1rem; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.row-between { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem; }
.grid-kues { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 1.25rem; align-items: start; }

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  container-type: inline-size;
}
.card-header {
  padding: 0.9rem 1.1rem;
  background: var(--surface-muted);
  border-bottom: 1px solid var(--border);
}
.card-body { padding: 1rem 1.1rem; }

/* Quick add bar */
.quick-add {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius);
  padding: 0.9rem 1.1rem;
  box-shadow: var(--shadow);
}
.quick-add form { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: stretch; }
.quick-add input[type="text"] { flex: 1 1 220px; font-size: 1.15rem; font-weight: 500; }
.quick-add input, .quick-add select, .quick-add button { min-height: 80px; }

/* Inputs & Buttons */
input[type="text"], input[type="password"], input[type="number"], select, textarea {
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 0.52rem 0.75rem;
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--text);
  background: #fff;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--primary);
  outline-offset: -1px;
  border-color: var(--primary);
}
textarea { width: 100%; min-height: 70px; resize: vertical; }
label.field { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.88rem; font-weight: 600; color: var(--text); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  border-radius: 8px;
  padding: 0.5rem 0.85rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s ease;
}
.btn:hover { background: #f1f5f9; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-sm { padding: 0.32rem 0.6rem; font-size: 0.82rem; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-success:hover { background: #166534; }
.btn-danger { background: #fff; border-color: #fecaca; color: var(--danger); }
.btn-danger:hover { background: var(--danger-bg); }
.btn-warn { background: var(--warn-bg); border-color: #fde68a; color: var(--warn); }

/* Badges & Pills */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  border-radius: 999px;
  padding: 0.18rem 0.58rem;
  font-size: 0.78rem;
  font-weight: 600;
  background: #e2e8f0;
  color: var(--text);
}
.badge-primary { background: var(--primary-soft); color: var(--primary); }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }

/* Entry rows */
.entry-list { list-style: none; margin: 0; padding: 0; }
.entry-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem 0.65rem;
  padding: 0.65rem 1.1rem;
  border-bottom: 1px solid var(--border);
}
.entry-main {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  min-width: 0;
}
.entry-ident {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}
.entry-meta {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  margin-left: auto;
  white-space: nowrap;
}
.entry-status {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
}
.entry-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 0.4rem;
}
@container (max-width: 560px) {
  .entry-main {
    flex: 1 0 100%;
  }
  .entry-status {
    flex: 1 0 100%;
  }
  .entry-status .badge {
    width: 100%;
    justify-content: center;
    padding: 0.32rem 0.65rem;
  }
  .entry-actions {
    flex: 1 0 100%;
  }
  .entry-actions .btn {
    flex: 1 1 0;
  }
}
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.85rem;
  height: 1.85rem;
  padding: 0;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  border-radius: 8px;
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
}
.btn-icon:hover { background: #e2e8f0; color: var(--text); }
.entry-item:last-child { border-bottom: none; }
.entry-current { background: #f0fdf4; border-left: 4px solid var(--success); }
.entry-done { background: #f8fafc; opacity: 0.72; }
.entry-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  height: 2rem;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.9rem;
  background: var(--primary-soft);
  color: var(--primary);
}
.entry-current .entry-num { background: var(--success); color: #fff; }
.entry-done .entry-num { background: #e2e8f0; color: var(--text-muted); }
.entry-phone { font-weight: 600; font-size: 0.98rem; color: var(--text); }

/* Alerts & Toast */
.alert {
  padding: 0.75rem 1rem;
  border-radius: 10px;
  font-size: 0.92rem;
  font-weight: 500;
  border: 1px solid transparent;
}
.alert-success { background: var(--success-bg); color: var(--success); border-color: #bbf7d0; }
.alert-danger { background: var(--danger-bg); color: var(--danger); border-color: #fecaca; }
.alert-info { background: var(--primary-soft); color: var(--primary); border-color: #c7d2fe; }

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 50;
}
.modal-panel {
  background: var(--surface);
  border-radius: var(--radius);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 35px rgba(15, 23, 42, 0.25);
}

/* Tables */
table.data-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
table.data-table th, table.data-table td {
  text-align: left;
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid var(--border);
}
table.data-table th { background: var(--surface-muted); font-weight: 600; color: var(--text-muted); }

/* Login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem; }
.login-card { width: 100%; max-width: 380px; }

/* HTMX loading indicator */
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { display: inline-flex; }
.muted { color: var(--text-muted); font-size: 0.86rem; }
