/* ==========================================================================
   Demo Accounts ERP — theme
   A fresh "teal / deep-slate / violet" palette — deliberately distinct from
   Mahil ERP's navy/amber look.
   ========================================================================== */

:root {
  --ink-900: #0b1320;
  --ink-800: #101a2c;
  --ink-700: #16233a;
  --ink-600: #223350;
  --ink-500: #3a4d6e;

  --slate-50:  #f6f8fb;
  --slate-100: #eef1f7;
  --slate-200: #dfe4ee;
  --slate-300: #c4cddc;
  --slate-500: #7c8aa3;
  --slate-600: #5b6a85;

  --teal-600: #0e8a83;
  --teal-500: #12a39a;
  --teal-400: #2ec2b8;
  --teal-100: #e2f6f4;

  --violet-600: #6d4de6;
  --violet-500: #7c5cf0;
  --violet-100: #efeafd;

  --amber-danger: #d64545;
  --amber-danger-bg: #fdeceb;
  --green-ok: #1c9d6c;
  --green-ok-bg: #e6f7ef;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  --shadow-sm: 0 1px 2px rgba(16, 26, 44, 0.06);
  --shadow-md: 0 6px 20px rgba(16, 26, 44, 0.08);

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: var(--font-sans);
  background: var(--slate-50);
  color: var(--ink-800);
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--teal-600); text-decoration: none; }
a:hover { color: var(--teal-500); text-decoration: underline; }

h1, h2, h3, h4 { font-weight: 650; color: var(--ink-900); margin: 0 0 0.5em; letter-spacing: -0.01em; }

/* ---------------------------------------------------------------------- */
/* App shell                                                              */
/* ---------------------------------------------------------------------- */

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 248px;
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--ink-900) 0%, var(--ink-800) 100%);
  color: var(--slate-200);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 22px 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--teal-400), var(--violet-500));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: #fff;
  font-size: 15px;
  flex-shrink: 0;
}

.brand-text { line-height: 1.15; }
.brand-text strong { display: block; color: #fff; font-size: 15px; font-weight: 700; }
.brand-text span { display: block; font-size: 11px; color: var(--slate-500); letter-spacing: 0.04em; text-transform: uppercase; }

.nav-group { padding: 14px 12px; }
.nav-group-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--slate-500);
  padding: 8px 12px 6px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--slate-300);
  font-size: 13.6px;
  font-weight: 500;
  margin-bottom: 2px;
}
.nav-link:hover { background: rgba(255,255,255,0.06); color: #fff; text-decoration: none; }
.nav-link.active { background: rgba(46, 194, 184, 0.14); color: var(--teal-400); }
.nav-link .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.7; flex-shrink: 0; }

.sidebar-foot {
  margin-top: auto;
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 12px;
  color: var(--slate-500);
}

/* ---------------------------------------------------------------------- */
/* Main column                                                            */
/* ---------------------------------------------------------------------- */

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  background: #fff;
  border-bottom: 1px solid var(--slate-200);
  position: sticky;
  top: 0;
  z-index: 5;
}

.topbar h1 { font-size: 18px; margin: 0; }

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--slate-600);
}
.user-chip .avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--violet-100); color: var(--violet-600);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
}

.content { padding: 26px 28px 60px; max-width: 1280px; width: 100%; }

/* ---------------------------------------------------------------------- */
/* Cards / stats                                                          */
/* ---------------------------------------------------------------------- */

.card {
  background: #fff;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.card-pad { padding: 22px 24px; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: #fff;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); text-decoration: none; }
.stat-card .stat-value { font-size: 26px; font-weight: 750; color: var(--ink-900); }
.stat-card .stat-label { font-size: 12.5px; color: var(--slate-600); margin-top: 4px; font-weight: 600; }
.stat-card .stat-bar { height: 3px; width: 34px; border-radius: 3px; background: var(--teal-400); margin-bottom: 12px; }

/* ---------------------------------------------------------------------- */
/* Page header + buttons                                                  */
/* ---------------------------------------------------------------------- */

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  line-height: 1.2;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--violet-600); color: #fff; }
.btn-primary:hover { background: var(--violet-500); color: #fff; }
.btn-outline { background: #fff; border-color: var(--slate-300); color: var(--ink-700); }
.btn-outline:hover { border-color: var(--teal-500); color: var(--teal-600); }
.btn-danger { background: var(--amber-danger-bg); color: var(--amber-danger); border-color: transparent; }
.btn-danger:hover { background: var(--amber-danger); color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }

/* ---------------------------------------------------------------------- */
/* Tables                                                                  */
/* ---------------------------------------------------------------------- */

.table-wrap {
  background: #fff;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

table.data-table { width: 100%; border-collapse: collapse; }
.data-table thead th {
  text-align: left;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--slate-600);
  background: var(--slate-50);
  padding: 12px 18px;
  border-bottom: 1px solid var(--slate-200);
  font-weight: 700;
}
.data-table tbody td {
  padding: 12px 18px;
  border-bottom: 1px solid var(--slate-100);
  font-size: 13.6px;
  color: var(--ink-800);
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--slate-50); }
.data-table .row-actions { display: flex; gap: 8px; justify-content: flex-end; }
.data-table td.num, .data-table th.num { text-align: right; font-variant-numeric: tabular-nums; }

.empty-state {
  padding: 48px 20px;
  text-align: center;
  color: var(--slate-600);
}
.empty-state strong { display: block; color: var(--ink-800); font-size: 15px; margin-bottom: 6px; }

.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  background: var(--teal-100); color: var(--teal-600);
}
.badge-muted { background: var(--slate-100); color: var(--slate-600); }

/* ---------------------------------------------------------------------- */
/* Forms                                                                   */
/* ---------------------------------------------------------------------- */

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px 20px;
}
.form-grid .full { grid-column: 1 / -1; }

.field { margin-bottom: 4px; }
.field label { display: block; font-size: 12.5px; font-weight: 650; color: var(--ink-700); margin-bottom: 6px; }
.field .helptext { font-size: 11.5px; color: var(--slate-500); margin-top: 4px; }
.field .errorlist { color: var(--amber-danger); font-size: 12px; margin: 4px 0 0; padding: 0; list-style: none; }

input[type=text], input[type=number], input[type=email], input[type=password],
input[type=date], input[type=file], select, textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--slate-300);
  border-radius: var(--radius-sm);
  font-size: 13.6px;
  font-family: var(--font-sans);
  color: var(--ink-800);
  background: #fff;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--teal-500);
  box-shadow: 0 0 0 3px var(--teal-100);
}
textarea { min-height: 80px; resize: vertical; }

.form-actions { display: flex; gap: 10px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--slate-100); }

/* Inline formset table (invoice items / voucher lines) */
.line-table { width: 100%; border-collapse: collapse; margin-top: 6px; }
.line-table th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--slate-600); padding: 8px 8px; border-bottom: 1px solid var(--slate-200);
}
.line-table td { padding: 6px 8px; vertical-align: top; }
.line-table input, .line-table select { padding: 7px 9px; font-size: 13px; }
.line-table .delete-cell { width: 40px; text-align: center; }

.section-title {
  font-size: 13px; font-weight: 700; color: var(--ink-800);
  margin: 26px 0 10px; padding-bottom: 8px; border-bottom: 1px solid var(--slate-200);
}

/* ---------------------------------------------------------------------- */
/* Messages / alerts                                                      */
/* ---------------------------------------------------------------------- */

.alert {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 13.4px;
  margin-bottom: 16px;
  border: 1px solid transparent;
}
.alert-success { background: var(--green-ok-bg); color: var(--green-ok); border-color: rgba(28,157,108,0.25); }
.alert-error   { background: var(--amber-danger-bg); color: var(--amber-danger); border-color: rgba(214,69,69,0.25); }
.alert-info    { background: var(--violet-100); color: var(--violet-600); border-color: rgba(124,92,240,0.2); }

/* ---------------------------------------------------------------------- */
/* Login page                                                              */
/* ---------------------------------------------------------------------- */

.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 15% 20%, rgba(46, 194, 184, 0.18), transparent 40%),
    radial-gradient(circle at 85% 80%, rgba(124, 92, 240, 0.20), transparent 45%),
    var(--ink-900);
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 60px rgba(0,0,0,0.35);
  padding: 34px 32px 28px;
}

.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.login-brand .brand-mark { width: 42px; height: 42px; font-size: 18px; }
.login-brand strong { display: block; font-size: 17px; color: var(--ink-900); }
.login-brand span { display: block; font-size: 11.5px; color: var(--slate-500); text-transform: uppercase; letter-spacing: 0.06em; }

.login-card .btn-primary { width: 100%; justify-content: center; padding: 11px 16px; margin-top: 6px; }
.login-foot { text-align: center; margin-top: 18px; font-size: 11.5px; color: var(--slate-500); }

/* ---------------------------------------------------------------------- */
/* Reports                                                                 */
/* ---------------------------------------------------------------------- */

.report-toolbar { display: flex; gap: 12px; align-items: end; margin-bottom: 18px; flex-wrap: wrap; }
.report-toolbar .field { margin-bottom: 0; min-width: 240px; }
.totals-row td { font-weight: 750; background: var(--slate-50); }

/* ---------------------------------------------------------------------- */
/* Responsive                                                              */
/* ---------------------------------------------------------------------- */

@media (max-width: 900px) {
  .app-shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: relative; flex-direction: row; overflow-x: auto; }
  .brand { border-bottom: none; }
  .nav-group { display: flex; gap: 4px; padding: 8px; }
  .nav-group-label { display: none; }
  .sidebar-foot { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .content { padding: 18px; }
  .topbar { padding: 14px 18px; }
}

@media (max-width: 560px) {
  .table-wrap { overflow-x: auto; }
  table.data-table { min-width: 560px; }
}
