/* ============================================================
   HONPAIN TECHNOLOGIES – DESIGN SYSTEM
   Structural layout preserved from original; visual layer modernised.
   ============================================================ */

/* ── Minimal normalise (replaces what was embedded inline) ── */
*, *::before, *::after { box-sizing: border-box; }
html { -ms-text-size-adjust: 100%; -webkit-text-size-adjust: 100%; overflow: hidden; height: 100%; }
body { margin: 0; height: 100%; overflow: hidden; }
img { border-style: none; max-width: 100%; height: auto; vertical-align: middle; }
a { background-color: transparent; }
a:active, a:hover { outline-width: 0; }
b, strong { font-weight: bolder; }
button, input, select, textarea, optgroup { font: inherit; margin: 0; }
button, input { overflow: visible; }
button, select { text-transform: none; }
[hidden], template { display: none; }

/* ── Design tokens ───────────────────────────────────────── */
:root {
  /* Kept the original variable names so existing templates don't break */
  --primary-blue:   #4f46e5;   /* modernised from #4033f8 */
  --dark-blue:      #3730a3;   /* modernised from #2023ce */
  --accent:         var(--primary-blue);
  --dark-text:      #1e293b;
  --sidebar-bg:     #1e293b;
  --sidebar-text:   #cbd5e1;
  --link-blue:      #6366f1;
  --cell-border:    #e2e8f0;
  --danger:         #ef4444;
  --row-hover:      #f8fafc;
  --row-selected:   #ede9fe;
  --table-bg:       #ffffff;
  --header-height:  52px;
  --sidebar-width:  220px;
  --toolbar-height: 40px;
  --shadow:         0 1px 3px rgba(0,0,0,0.10), 0 1px 2px rgba(0,0,0,0.06);

  /* Additional modern tokens */
  --success:        #10b981;
  --warning:        #f59e0b;
  --info:           #3b82f6;
  --bg:             #f1f5f9;
  --surface:        #ffffff;
  --border:         #e2e8f0;
  --border-strong:  #cbd5e1;
  --text-primary:   #0f172a;
  --text-secondary: #475569;
  --text-muted:     #94a3b8;
  --radius-sm:      4px;
  --radius:         8px;
  --radius-lg:      12px;
  --radius-full:    9999px;
  --transition:     150ms ease;
  --font: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
}

/* ── Base typography ─────────────────────────────────────── */
html, body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg);
}
h1,h2,h3,h4,h5,h6 {
  font-family: var(--font);
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-primary);
  margin: 10px 0;
}
a { color: var(--link-blue); text-decoration: none; }
a:hover { text-decoration: underline; }
hr { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }

/* ── Top header bar (position:fixed, full-width) ─────────── */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--sidebar-bg);
  display: flex;
  align-items: center;
  padding: 0 16px;
  margin: 0;
  color: white;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
  font-size: 14px;
  z-index: 100;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.brand { display: flex; align-items: center; gap: 12px; font-weight: 700; flex-shrink: 0; }

.brand-name {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  padding-right: 16px;
  padding-left: 16px;
  border-right: 1px solid rgba(255,255,255,0.15);
  white-space: nowrap;
}

.top-tabs {
  margin-left: 16px;
  display: flex;
  gap: 2px;
  align-items: center;
  flex-grow: 1;
  overflow-x: auto;
  scrollbar-width: none;
}
.top-tabs::-webkit-scrollbar { display: none; }

.top-tab {
  padding: 0;
  height: var(--header-height);
  display: flex;
  align-items: center;
  cursor: pointer;
  flex-shrink: 0;
}

.top-tab.active .top-tab-link { border-bottom: 2px solid var(--warning); color: #fff; }

.top-tab:hover:not(.active) .top-tab-link {
  background: rgba(255,255,255,0.08);
  color: #fff;
}

.top-tab-link {
  color: rgba(255,255,255,0.78);
  text-decoration: none;
  padding: 0 14px;
  display: flex;
  align-items: center;
  height: var(--header-height);
  font-size: 13px;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
}
.top-tab-link:hover { text-decoration: none; }

.top-actions { display: flex; align-items: center; gap: 16px; margin-left: auto; flex-shrink: 0; }

.notification-wrapper { position: relative; display: flex; align-items: center; }

.notification-badge {
  position: absolute;
  top: -6px;
  right: -8px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
}

.user-icon { font-size: 20px; cursor: pointer; color: rgba(255,255,255,0.8); transition: color var(--transition); }
.user-icon:hover { color: #fff; }

/* ── Sidebar (position:fixed, starts below topbar) ───────── */
.ht-sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  color: white;
  padding: 8px 0 16px;
  height: calc(100vh - var(--header-height));
  position: fixed;
  overflow-y: auto;
  top: var(--header-height);
  left: 0;
  display: flex;
  flex-direction: column;
  z-index: 90;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
  border-right: 1px solid rgba(255,255,255,0.05);
  box-shadow: 2px 0 8px rgba(0,0,0,0.15);
}
.ht-sidebar::-webkit-scrollbar { width: 4px; }
.ht-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 4px; }

/* Sidebar section group */
.user-settings {
  padding: 16px 10px 16px;
  margin-top: 10px;
}

.user-settings h5 {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin: 0 0 6px 6px;
  padding: 0;
  border: none;
}

.user-settings a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius);
  color: var(--sidebar-text);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: background var(--transition), color var(--transition);
  margin-bottom: 2px;
  border-left: 2px solid transparent;
}
.user-settings a i { width: 16px; text-align: center; font-size: 13px; opacity: 0.8; flex-shrink: 0; }
.user-settings a:hover { background: rgba(255,255,255,0.07); color: #fff; text-decoration: none; }
.user-settings a.active { background: rgba(255,255,255,0.10); color: #fff; border-left-color: var(--warning); }

/* Sidebar legacy nav-item class */
.nav-item {
  padding: 8px 16px;
  display: flex;
  gap: 10px;
  align-items: center;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 13px;
  cursor: pointer;
  border-left: 2px solid transparent;
  transition: background var(--transition), color var(--transition);
}
.nav-item:hover:not(.active) { background: rgba(255,255,255,0.05); }
.nav-item.active { background: rgba(255,255,255,0.08); color: white; border-left-color: var(--warning); }
.nav-item i { margin-right: 5px; font-size: 14px; width: 18px; }

/* Mobile sidebar overlay */
.w3-overlay {
  position: fixed;
  display: none;
  width: 100%;
  height: 100%;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 80;
}

/* ── Content container (clears fixed topbar + sidebar) ──────── */
#content_container {
  position: fixed;
  top: var(--header-height);
  left: var(--sidebar-width);
  right: 0;
  bottom: 0;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--bg);
}

@media (max-width: 600px) {
  #content_container { left: 0; }
}

/* Optional padding wrapper for pages that want padded content */
.page-wrapper { padding: 20px 24px; }

/* ── Footer ──────────────────────────────────────────────── */
.ht-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 38px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--text-muted);
  z-index: 50;
}
.ht-footer a { color: var(--primary-blue); font-weight: 600; text-decoration: none; }
.ht-footer a:hover { text-decoration: underline; }

/* ── Snackbar / Toast ────────────────────────────────────── */
#snackbar-container {
  position: fixed;
  top: calc(var(--header-height) + 12px);
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.message {
  visibility: hidden;
  min-width: 260px;
  max-width: 400px;
  color: #fff;
  text-align: center;
  border-radius: var(--radius);
  padding: 12px 16px;
  position: relative;
  opacity: 0;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  pointer-events: auto;
}

.message.show {
  visibility: visible;
  animation: snackbar-in 0.35s forwards, snackbar-out 0.35s 3.6s forwards;
}

#toast-container {
    position: fixed;
    top: calc(var(--header-height) + 12px);
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    padding: 12px 16px;
    margin-bottom: 10px;
    border-radius: 6px;
    color: white;
    font-size: 14px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.toast-success {
    background: #198754;
}

.toast-error {
    background: #dc3545;
}

.toast-info {
    background: #0d6efd;
}

/* snackbar-top / snackbar-bottom: positioning is handled by #snackbar-container */

@keyframes snackbar-in  { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes snackbar-out { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(-6px); } }

/* ── Tabs (JS + class-based, opacity switching) ──────────── */
.ht-tabs {
  position: relative;
  height: inherit;
  width: 100%;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  background: var(--sidebar-bg);
}
.ht-tabs::-webkit-scrollbar { display: none; }

.ht-tab { display: inline-flex; flex-shrink: 0; }

.ht-tab-label {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  padding: 0 22px;
  background: transparent;
  border-right: 1px solid rgba(255,255,255,0.08);
  color: var(--sidebar-text);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  user-select: none;
  border-top: 3px solid transparent;
  letter-spacing: 0.01em;
  transition: background var(--transition), color var(--transition);
}
.ht-tab-label:hover {
  background: rgba(255,255,255,0.07);
  color: #fff;
}
.ht-tab-label.active {
  background: var(--surface);
  color: var(--primary-blue);
  border-top-color: var(--primary-blue);
  font-weight: 700;
  z-index: 3;
}

.ht-tab-content {
  position: absolute;
  z-index: 1;
  top: 44px;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 16px 20px 80px;
  background: var(--surface);
  color: var(--text-primary);
  border-top: 1px solid var(--border);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  overflow-y: auto;
  overflow-x: hidden;
}
.ht-tab-content.active {
  z-index: 2;
  opacity: 1;
  pointer-events: auto;
}

/* ── Loader ──────────────────────────────────────────────── */
.loader {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--primary-blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 40px auto;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.card-title { font-size: 14px; font-weight: 700; color: var(--text-primary); margin: 0; }

.box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn,
.submit-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 16px;
  height: 34px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  vertical-align: middle;
  box-sizing: border-box;
  transition: background var(--transition), box-shadow var(--transition), transform 80ms ease;
}
.btn:focus-visible, .submit-button:focus-visible { outline: 2px solid var(--primary-blue); outline-offset: 2px; }
.btn:active, .submit-button:active { transform: scale(0.98); }

.btn-primary, .submit-button {
  background: var(--primary-blue);
  color: #fff;
  border-color: var(--primary-blue);
}
.btn-primary:hover, .submit-button:hover { background: var(--dark-blue); color: #fff; text-decoration: none; }

.btn-secondary {
  background: var(--surface);
  color: var(--text-secondary);
  border-color: var(--border-strong);
}
.btn-secondary:hover { background: var(--bg); color: var(--text-primary); text-decoration: none; }

.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-success:hover { background: #059669; color: #fff; text-decoration: none; }

.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #dc2626; color: #fff; text-decoration: none; }

.btn-warning { background: #f59e0b; color: #fff; border-color: #f59e0b; }
.btn-warning:hover { background: #d97706; color: #fff; text-decoration: none; }

.btn-sm { height: 28px; padding: 0 10px; font-size: 12px; }
.btn-lg { height: 42px; padding: 0 24px; font-size: 15px; }
.w-full { width: 100%; }

.btn:disabled, .submit-button:disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }

/* W3.CSS button style unification */
.w3-btn, .w3-button {
  font-family: var(--font) !important;
  font-weight: 600;
  border-radius: var(--radius) !important;
}
.w3-btn.w3-blue, .w3-button.w3-blue { background: var(--info) !important; }
.w3-btn.w3-indigo, .w3-button.w3-indigo { background: var(--primary-blue) !important; }
.w3-btn.w3-green, .w3-button.w3-green { background: var(--success) !important; }
.w3-btn.w3-red, .w3-button.w3-red { background: var(--danger) !important; }

/* ── Forms ───────────────────────────────────────────────── */
label {
  display: block;
  margin-left: 2px;
  margin-bottom: 5px;
  font-weight: 600;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: default;
}

.helptext {
  display: block;
  margin-top: 4px;
  margin-left: 2px;
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
}

form p { margin-bottom: 14px; padding: 0; }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="url"],
input[type="search"],
textarea,
select {
  display: block;
  width: 80%;
  padding: 6px 10px;
  font-family: var(--font);
  font-size: 13px;
  color: var(--text-primary);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-sizing: border-box;
  margin-top: 2px;
  height: 34px;
  transition: border-color var(--transition), box-shadow var(--transition);
}

textarea { height: auto; min-height: 90px; resize: vertical; padding-top: 8px; }

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="url"]:focus,
input[type="search"]:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(79,70,229,0.12);
}

select {
  background-color: white;
  height: 34px;
  padding-right: 28px;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2364748b' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}

select[multiple] {
  height: auto;
  min-height: 100px;
  background-image: none;
  padding-right: 10px;
}

input[type="checkbox"],
input[type="radio"] {
  width: 7%;
  accent-color: var(--primary-blue);
  transform: scale(1.3);
  margin: 10px 0 5px 10px;
  display: block;
}

input[type="file"] {
  display: block;
  width: 100%;
  padding: 6px 10px;
  font-size: 13px;
  color: var(--text-secondary);
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  cursor: pointer;
  height: auto;
}
input[type="file"]:hover { border-color: var(--primary-blue); }

input:disabled, select:disabled, textarea:disabled, button:disabled {
  background: #f2f2f2;
  border-color: var(--border);
  color: var(--text-muted);
  cursor: not-allowed;
}

.form-group { margin-bottom: 16px; }
.button-container { text-align: center; margin-top: 20px; margin-bottom: 10px; }

/* Filter form row */
.filter-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filter-form input[type="text"],
.filter-form input[type="search"],
.filter-form input[type="email"] {
  display: inline-flex;
  width: auto;
  flex: 1 1 160px;
  max-width: 240px;
  margin: 0;
  height: 34px;
}
.filter-form select {
  display: inline-flex;
  width: auto;
  flex: 0 1 150px;
  max-width: 165px;
  margin: 0;
  height: 34px;
}
.filter-form input[type="date"] {
  display: inline-flex;
  width: auto;
  flex: 0 1 140px;
  max-width: 150px;
  margin: 0;
  height: 34px;
}
.filter-form .btn,
.filter-form .submit-button {
  margin-top: 0;
  height: 34px;
  width: auto;
  flex-grow: 0;
  flex-shrink: 0;
  font-size: 12px;
  padding: 0 14px;
}

/* ── Tables ──────────────────────────────────────────────── */
.table-container {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.table-scroll { overflow-x: auto; overflow-y: auto; max-height: 600px; }

.w3-table, .w3-table-all { border-collapse: collapse; border-spacing: 0; width: 100%; display: table; }
.w3-table-all { border: 1px solid var(--border); }
.w3-bordered tr, .w3-table-all tr { border-bottom: 1px solid var(--border); }
.w3-table-all tr:nth-child(odd) { background-color: var(--surface); }
.w3-table-all tr:nth-child(even) { background-color: #f8fafc; }
.w3-hoverable tbody tr:hover, .w3-ul.w3-hoverable li:hover { background-color: var(--row-hover) !important; }
.w3-table td, .w3-table th, .w3-table-all td, .w3-table-all th {
  padding: 6px 12px;
  display: table-cell;
  text-align: left;
  vertical-align: middle;
  font-size: 13px;
}
.w3-table th:first-child, .w3-table td:first-child,
.w3-table-all th:first-child, .w3-table-all td:first-child { padding-left: 16px; }

/* Modern table header – dark theme matches tab bar */
thead tr.w3-blue th,
thead tr th {
  background: var(--sidebar-bg) !important;
  color: rgba(255,255,255,0.75) !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.06em !important;
  border-bottom: none !important;
  position: sticky !important;
  top: 0 !important;
  z-index: 2 !important;
}

/* ── Pagination ──────────────────────────────────────────── */
.pagination {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  justify-content: center;
  padding: 16px 0;
}

.pagination a, .pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  background: var(--surface);
  transition: background var(--transition);
}
.pagination a:hover { background: var(--bg); color: var(--primary-blue); text-decoration: none; }
.pagination .w3-blue { background: var(--primary-blue) !important; color: #fff !important; border-color: var(--primary-blue) !important; }
.pagination .w3-disabled { color: var(--text-muted) !important; pointer-events: none; background: var(--bg) !important; }
.pagination .current { background: var(--primary-blue); color: #fff; border-color: var(--primary-blue); }

/* ── Dashboard / org sections ────────────────────────────── */
.organisation-dashboard { padding: 20px; background: var(--bg); border-radius: var(--radius-lg); }
.dashboard-section {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 18px;
  margin-bottom: 14px;
}
.dashboard-section h3, .dashboard-section h4 { font-size: 14px; font-weight: 700; color: var(--primary-blue); margin-bottom: 8px; }
.profile-container { padding: 20px; background: var(--bg); border-radius: var(--radius-lg); }

/* ── Drag-and-drop upload ────────────────────────────────── */
.ht-drag-drop-area, .drag-drop-area {
  width: 100%;
  min-height: 140px;
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  padding: 24px;
  transition: border-color var(--transition), background var(--transition);
  color: var(--text-muted);
  text-align: center;
}
.ht-drag-drop-area:hover, .drag-drop-area:hover,
.ht-drag-drop-area.dragover, .drag-drop-area.dragover {
  border-color: var(--primary-blue);
  background: rgba(79,70,229,0.04);
  color: var(--primary-blue);
}
.ht-drag-drop-area input[type="file"],
.drag-drop-area input[type="file"] { display: none; }

.drag-overlay {
  display: none;
  position: absolute;
  inset: 0;
  background: rgba(79,70,229,0.85);
  border-radius: inherit;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  z-index: 10;
}
.drag-drop-area { position: relative; }
.drag-drop-area.dragover .drag-overlay { display: flex; }

/* ── Progress bar ────────────────────────────────────────── */
.ht-progress {
  width: 100%;
  height: 6px;
  background: var(--border);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-top: 8px;
}
.ht-progress-bar {
  height: 100%;
  width: 0%;
  background: var(--primary-blue);
  border-radius: var(--radius-full);
  transition: width 0.4s ease;
}

/* ── Step indicator ──────────────────────────────────────── */
.ht-step { display: inline-block; width: 10px; height: 10px; margin: 0 3px; background: var(--border-strong); border-radius: 50%; opacity: 0.5; }
.ht-step.active { opacity: 1; background: var(--primary-blue); }
.ht-step.finish { background: var(--success); opacity: 1; }
.ht-step-tab { display: none; }

/* ── File upload button ──────────────────────────────────── */
.file-upload, .custom-file-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: var(--primary-blue);
  color: #fff;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--transition);
  text-decoration: none;
}
.file-upload:hover, .custom-file-button:hover { background: var(--dark-blue); color: #fff; text-decoration: none; }

/* ── Fieldset / legend ───────────────────────────────────── */
fieldset {
  border: 2px solid rgba(79,70,229,0.25);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin: 14px 0;
  background: var(--surface);
  box-shadow: var(--shadow);
  position: relative;
}
legend {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary-blue);
  background: var(--surface);
  padding: 0 8px;
  border-radius: var(--radius-sm);
}

/* ── Alert / badge / misc ────────────────────────────────── */
.alert { padding: 12px 16px; border-radius: var(--radius); font-size: 13px; font-weight: 500; margin-bottom: 14px; }
.alert-danger  { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }
.alert-info    { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }

.badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: var(--radius-full); font-size: 11px; font-weight: 700; }
.badge-primary { background: #e0e7ff; color: #3730a3; }
.badge-success { background: #d1fae5; color: #065f46; }
.badge-danger  { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }

/* ── Login page ──────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #111D52 0%, #1B2A6B 55%, #1e3a8a 100%);
  padding: 24px;
}
.login-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 40px rgba(0,0,0,0.2);
  padding: 40px;
  width: 100%;
  max-width: 400px;
}
.login-logo { display: block; max-width: 90px; margin: 0 auto 20px; }
.login-title { font-size: 22px; font-weight: 700; text-align: center; color: var(--text-primary); margin-bottom: 4px; }
.login-subtitle { font-size: 13px; color: var(--text-muted); text-align: center; margin-bottom: 24px; }
.login-footer-row { display: flex; align-items: center; justify-content: space-between; margin-top: 20px; font-size: 13px; }
.remember-row { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-secondary); font-weight: 500; margin-bottom: 0; }

/* ── W3.CSS colour overrides ─────────────────────────────── */
.w3-blue,   .w3-hover-blue:hover   { background-color: var(--info)         !important; color: #fff !important; }
.w3-indigo, .w3-hover-indigo:hover { background-color: var(--primary-blue)  !important; color: #fff !important; }
.w3-light-indigo, .w3-hover-light-indigo:hover { background-color: rgba(79,70,229,0.85) !important; color: #fff !important; }
.w3-green,  .w3-hover-green:hover  { background-color: var(--success)       !important; color: #fff !important; }
.w3-red,    .w3-hover-red:hover    { background-color: var(--danger)        !important; color: #fff !important; }
.w3-light-green, .w3-hover-light-green:hover { background-color: #34d399 !important; color: #fff !important; }

/* ── Sticky header helpers ───────────────────────────────── */
.ht-sticky, .ht-header { position: sticky; top: 0; background: var(--sidebar-bg); color: rgba(255,255,255,0.75); z-index: 2; }

/* ── Misc helpers ────────────────────────────────────────── */
.ht-font-14 { font-size: 14px !important; }
.text-muted     { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.d-flex         { display: flex !important; }
.align-center   { align-items: center; }
.gap-8          { gap: 8px; }
.gap-16         { gap: 16px; }

/* Table action cells that need flex layout */
td.d-flex { display: flex !important; align-items: center; }

/* ── Modal ───────────────────────────────────────────────── */
.w3-modal { z-index: 200; }
.w3-modal-content { border-radius: var(--radius-lg) !important; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 992px) {
  .w3-hide-large { display: none !important; }
  .w3-sidebar.w3-collapse { display: none; }
  .w3-main { margin-left: 0 !important; margin-right: 0 !important; }
}
@media (min-width: 993px) {
  .w3-hide-large { display: none !important; }
  .w3-sidebar.w3-collapse { display: block !important; }
}
@media (max-width: 600px) {
  .login-card { padding: 24px; }
  .w3-modal-content { margin: 0 10px; width: auto !important; }
}

/* ── Page panel (main content area with tab system) ──────── */
.page-panel {
  height: calc(100vh - var(--header-height));
  width: 100%;
  position: absolute;
  border: 1px solid var(--border);
  border-top: none;
  box-shadow: inset 0 1px 0 var(--border);
  color: var(--text-primary);
  background: var(--surface);
}

/* ── Tab toolbar (action buttons above tab content) ──────── */
.tab-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 0 8px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}

/* ── Mobile spacer (push content below fixed nav on small screens) */
.mobile-push-lg { margin-top: 80px; }

/* ── Home / landing feature cards ───────────────────────── */
.home-feature-card { min-height: 320px; padding: 24px 16px; }
.home-feature-icon { font-size: 80px; display: block; margin: 12px auto; }

/* ── Hero section ────────────────────────────────────────── */
.ht-hero {
  background: linear-gradient(135deg, var(--sidebar-bg) 0%, #312e81 60%, var(--primary-blue) 100%);
  padding: 72px 32px 60px;
  text-align: center;
  color: #fff;
}
.ht-hero h1 {
  font-size: 28px; font-weight: 800; color: #fff;
  margin: 0 0 12px; letter-spacing: -0.02em; line-height: 1.25;
}
.ht-hero p {
  font-size: 15px; color: rgba(255,255,255,0.72);
  max-width: 520px; margin: 0 auto 28px; line-height: 1.7;
}
.ht-hero-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 14px; background: rgba(255,255,255,0.12);
  border-radius: var(--radius-full); font-size: 11px; font-weight: 700;
  color: rgba(255,255,255,0.85); margin-bottom: 20px;
  letter-spacing: 0.06em; text-transform: uppercase;
}
.ht-hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.btn-hero-primary {
  display: inline-flex; align-items: center; gap: 8px;
  height: 44px; padding: 0 28px; font-size: 14px; font-weight: 700;
  background: #fff; color: var(--primary-blue); border: none;
  border-radius: var(--radius-lg); cursor: pointer; text-decoration: none;
  transition: background var(--transition); font-family: var(--font);
}
.btn-hero-primary:hover { background: rgba(255,255,255,0.9); color: var(--dark-blue); text-decoration: none; }
.btn-hero-ghost {
  display: inline-flex; align-items: center; gap: 8px;
  height: 44px; padding: 0 28px; font-size: 14px; font-weight: 700;
  background: rgba(255,255,255,0.12); color: #fff;
  border: 1px solid rgba(255,255,255,0.30); border-radius: var(--radius-lg);
  cursor: pointer; text-decoration: none; transition: background var(--transition);
  font-family: var(--font);
}
.btn-hero-ghost:hover { background: rgba(255,255,255,0.20); color: #fff; text-decoration: none; }

/* ── Feature cards ───────────────────────────────────────── */
.ht-features { padding: 48px 32px; background: var(--bg); }
.ht-features-title { text-align: center; font-size: 18px; font-weight: 700; color: var(--text-primary); margin: 0 0 32px; }
.ht-features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px; max-width: 860px; margin: 0 auto;
}
.ht-feature-card {
  background: var(--surface); border-radius: var(--radius-lg);
  border: 1px solid var(--border); box-shadow: var(--shadow);
  padding: 28px 24px; text-align: center;
  transition: box-shadow 0.2s ease, transform 0.15s ease;
  text-decoration: none; color: inherit; display: block;
}
.ht-feature-card:hover { box-shadow: 0 8px 24px rgba(79,70,229,0.12); transform: translateY(-2px); text-decoration: none; color: inherit; }
.ht-feature-icon-wrap {
  width: 56px; height: 56px; border-radius: var(--radius-lg);
  background: rgba(79,70,229,0.10); color: var(--primary-blue);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; margin: 0 auto 14px;
}
.ht-feature-step {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--primary-blue); color: #fff;
  font-size: 11px; font-weight: 700; margin-bottom: 10px;
}
.ht-feature-card h3 { font-size: 12px; font-weight: 700; color: var(--text-primary); margin: 0 0 8px; text-transform: uppercase; letter-spacing: 0.05em; }
.ht-feature-card p { font-size: 13px; color: var(--text-secondary); line-height: 1.6; margin: 0; }

/* ── Wizard step bar ─────────────────────────────────────── */
.wizard-step-bar { display: flex; align-items: center; margin-bottom: 28px; }
.wizard-step-item { display: flex; flex-direction: column; align-items: center; flex: 0 0 auto; }
.wizard-step-dot {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--border); color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
  transition: background var(--transition), color var(--transition);
}
.wizard-step-dot.active { background: var(--primary-blue); color: #fff; }
.wizard-step-dot.done { background: var(--success); color: #fff; }
.wizard-step-label { font-size: 11px; font-weight: 600; color: var(--text-muted); margin-top: 6px; text-align: center; white-space: nowrap; }
.wizard-step-line { flex: 1; height: 2px; background: var(--border); margin: 0 8px; margin-bottom: 20px; min-width: 32px; }

/* ── Table toolbar ───────────────────────────────────────── */
.ht-table-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 0 12px; flex-wrap: wrap; }
.ht-table-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ht-search-wrap { position: relative; flex: 1; min-width: 180px; max-width: 280px; }
.ht-search-wrap i { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 11px; pointer-events: none; }
.ht-search-wrap input[type="text"],
.ht-search-wrap input[type="search"] {
  width: 100%; height: 32px; padding: 0 8px 0 30px;
  font-size: 13px; border: 1px solid var(--border-strong);
  border-radius: var(--radius); background: var(--surface);
  display: block; margin: 0; color: var(--text-primary);
}
.ht-search-wrap input:focus { border-color: var(--primary-blue); outline: none; box-shadow: 0 0 0 3px rgba(79,70,229,0.10); }
.ht-table-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0 0; flex-wrap: wrap; }
.ht-table-count { font-size: 12px; color: var(--text-muted); }

/* Client-side pagination */
.ht-pagination { display: flex; align-items: center; gap: 3px; flex-wrap: wrap; }
.ht-page-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 30px; height: 30px; padding: 0 6px;
  border-radius: var(--radius-sm); font-size: 12px; font-weight: 500;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-secondary); cursor: pointer;
  transition: background var(--transition); user-select: none;
  line-height: 1; font-family: var(--font);
}
.ht-page-btn:hover:not(.active):not([disabled]) { background: var(--bg); color: var(--primary-blue); border-color: var(--primary-blue); }
.ht-page-btn.active { background: var(--primary-blue); color: #fff; border-color: var(--primary-blue); }
.ht-page-btn[disabled] { color: var(--text-muted); cursor: not-allowed; opacity: 0.5; }

/* Inside a tab-content the outer container already scrolls — remove the nested cap */
.ht-tab-content .table-scroll { max-height: none; overflow-y: visible; }
