/* ============================================================
   AACSAT Veggie Desk -- Desktop Application UI
   Refined utilitarian theme: high contrast, dense, fast to scan.
   ============================================================ */

:root {
  --bg:        #0f1623;
  --bg-2:      #151e2e;
  --panel:     #ffffff;
  --panel-2:   #f4f6fa;
  --ink:       #1b2433;
  --ink-soft:  #5b6877;
  --line:      #e3e8f0;
  --brand:     #138a52;     /* fresh green */
  --brand-2:   #0f6d40;
  --brand-soft:#e6f4ec;
  --accent:    #f0a500;     /* amber */
  --danger:    #d64545;
  --danger-soft:#fbe9e9;
  --info:      #2f6fed;
  --radius:    10px;
  --shadow:    0 1px 3px rgba(16,24,40,.08), 0 1px 2px rgba(16,24,40,.06);
  --shadow-lg: 0 12px 30px rgba(16,24,40,.16);
  --sidebar-w: 248px;
  --topbar-h:  60px;
  --font:      'Inter Tight', 'Noto Sans Tamil', system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: var(--font);
  background: var(--panel-2);
  color: var(--ink);
  font-size: 14.5px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

/* ---------- App shell ---------- */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--topbar-h) 1fr;
  grid-template-areas: "side top" "side main";
  height: 100vh;
  overflow: hidden;
  transition: grid-template-columns .18s ease;
}

/* Collapsed: hide the sidebar, content spans full width */
.app.nav-collapsed {
  grid-template-columns: 0 1fr;
}
.app.nav-collapsed .sidebar {
  transform: translateX(-100%);
  opacity: 0;
  pointer-events: none;
}

/* Hamburger toggle in the topbar */
.menu-toggle {
  width: 38px; height: 38px; flex-shrink: 0;
  border: 1px solid var(--line); background: var(--panel);
  border-radius: 9px; cursor: pointer; font-size: 18px; color: var(--ink);
  display: grid; place-items: center; transition: background .12s;
}
.menu-toggle:hover { background: var(--panel-2); }

/* ---------- Sidebar ---------- */
.sidebar {
  grid-area: side;
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  color: #cdd6e4;
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(255,255,255,.04);
  overflow: hidden;
  transition: transform .18s ease, opacity .18s ease;
}
.brand {
  display: flex; align-items: center; gap: 11px;
  padding: 18px 20px;
  font-weight: 800; font-size: 18px; letter-spacing: -.2px;
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.brand .logo {
  width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(135deg, var(--brand) 0%, #1fb567 100%);
  display: grid; place-items: center; font-size: 18px;
  box-shadow: 0 4px 12px rgba(31,181,103,.35);
}
.brand small { display:block; font-size: 10.5px; font-weight: 500; color: #7d8aa0; letter-spacing: .5px; }

.nav { padding: 12px 12px; flex: 1; overflow-y: auto; }
.nav .group-label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .8px;
  color: #5d6a80; padding: 14px 12px 6px; font-weight: 700;
}
.nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 8px;
  color: #b3bfd1; font-weight: 500; font-size: 14px;
  margin-bottom: 2px; transition: all .12s;
}
.nav a .ic { width: 18px; text-align: center; opacity: .85; }
.nav a:hover { background: rgba(255,255,255,.05); color: #fff; }
.nav a.active {
  background: linear-gradient(90deg, rgba(31,181,103,.18), rgba(31,181,103,.04));
  color: #fff;
  box-shadow: inset 3px 0 0 var(--brand);
}
.nav .badge-soon {
  margin-left: auto; font-size: 9.5px; background: #2a3547; color: #8b97ac;
  padding: 2px 7px; border-radius: 20px; font-weight: 600;
}
.sidebar-foot {
  padding: 14px 18px; font-size: 11.5px; color: #6b7689;
  border-top: 1px solid rgba(255,255,255,.06);
}

/* ---------- Topbar ---------- */
.topbar {
  grid-area: top;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 16px;
  padding: 0 22px;
}
.topbar h1 { font-size: 16px; font-weight: 700; letter-spacing: -.2px; }
.topbar .spacer { flex: 1; }
.topbar .date { color: var(--ink-soft); font-size: 13px; font-weight: 500; }
.user-chip {
  display: flex; align-items: center; gap: 9px;
  padding: 6px 12px; background: var(--panel-2); border-radius: 30px;
  font-size: 13px; font-weight: 600;
}
.user-chip .avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), #1fb567);
  color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 700;
}
.user-chip .role { font-size: 11px; color: var(--ink-soft); font-weight: 500; }

/* ---------- Main scroll area ---------- */
.main {
  grid-area: main;
  overflow-y: auto;
  padding: 26px 30px 40px;
}
.page-head { display:flex; align-items:center; gap:14px; margin-bottom: 22px; }
.page-head h2 { font-size: 23px; font-weight: 800; letter-spacing: -.4px; }
.page-head .sub { color: var(--ink-soft); font-size: 13.5px; }
.page-head .spacer { flex: 1; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px; border-radius: 8px; border: 1px solid transparent;
  font-family: var(--font); font-size: 14px; font-weight: 600;
  cursor: pointer; transition: all .12s; white-space: nowrap;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-2); }
.btn-light { background: var(--panel); color: var(--ink); border-color: var(--line); }
.btn-light:hover { background: var(--panel-2); }
.btn-danger { background: var(--danger); color:#fff; }
.btn-danger:hover { filter: brightness(.93); }
.btn-ghost { background: transparent; color: var(--ink-soft); }
.btn-ghost:hover { background: var(--panel-2); color: var(--ink); }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }
.btn-lg { padding: 13px 22px; font-size: 16px; }
.btn-block { width: 100%; justify-content: center; }

/* ---------- Cards / panels ---------- */
.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card-pad { padding: 20px 22px; }
.card-head {
  padding: 15px 20px; border-bottom: 1px solid var(--line);
  font-weight: 700; font-size: 15px; display:flex; align-items:center; gap:9px;
}

/* ---------- Stat cards ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 22px; }
.stat {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 20px;
  display: flex; align-items: center; gap: 16px; box-shadow: var(--shadow);
}
.stat .ic {
  width: 48px; height: 48px; border-radius: 12px; flex-shrink:0;
  display: grid; place-items: center; font-size: 22px;
}
.stat .label { font-size: 12.5px; color: var(--ink-soft); font-weight: 600; }
.stat .value { font-size: 24px; font-weight: 800; letter-spacing: -.5px; margin-top: 2px; }
.ic-green { background: var(--brand-soft); color: var(--brand-2); }
.ic-blue  { background: #e7effe; color: var(--info); }
.ic-amber { background: #fdf3da; color: #b07b00; }
.ic-teal  { background: #e0f3f4; color: #0d8a92; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.8px; }
table.data th {
  text-align: left; padding: 12px 16px; background: var(--panel-2);
  color: var(--ink-soft); font-weight: 700; font-size: 11.5px;
  text-transform: uppercase; letter-spacing: .5px;
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.data td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tr:last-child td { border-bottom: none; }
table.data tbody tr:hover { background: #fafbfd; }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; }
.empty { text-align: center; padding: 38px; color: var(--ink-soft); }

/* ---------- Pills / tags ---------- */
.pill { display:inline-flex; align-items:center; gap:5px; padding: 3px 10px; border-radius: 20px; font-size: 11.5px; font-weight: 700; }
.pill-green { background: var(--brand-soft); color: var(--brand-2); }
.pill-amber { background: #fdf3da; color: #a06f00; }
.pill-red   { background: var(--danger-soft); color: var(--danger); }
.pill-gray  { background: #eef1f6; color: var(--ink-soft); }
.pill-blue  { background: #e7effe; color: var(--info); }

/* ---------- Forms ---------- */
.form-grid { display: grid; gap: 16px; }
.form-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.field label { display: block; font-size: 12.5px; font-weight: 700; color: var(--ink-soft); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 10px 13px; border: 1px solid var(--line); border-radius: 8px;
  font-family: var(--font); font-size: 14.5px; background: var(--panel); color: var(--ink);
  transition: border .12s, box-shadow .12s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft);
}
.field .err { color: var(--danger); font-size: 12px; margin-top: 5px; font-weight: 600; }
.field.has-err input, .field.has-err select { border-color: var(--danger); }
.field .hint { font-size: 11.5px; color: var(--ink-soft); margin-top: 5px; }
.check { display: flex; align-items: center; gap: 9px; font-weight: 600; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--brand); }
.form-actions { display: flex; gap: 10px; margin-top: 8px; }

/* ---------- Flash ---------- */
.flash {
  padding: 12px 18px; border-radius: 9px; margin-bottom: 18px;
  font-weight: 600; font-size: 14px; display:flex; align-items:center; gap:10px;
}
.flash-success { background: var(--brand-soft); color: var(--brand-2); border: 1px solid #bfe6cf; }
.flash-error   { background: var(--danger-soft); color: var(--danger); border: 1px solid #f3c9c9; }

/* ---------- Login ---------- */
.login-wrap {
  min-height: 100vh; display: grid; place-items: center;
  background: radial-gradient(1200px 600px at 70% -10%, #1b3a2a 0%, transparent 60%),
              linear-gradient(180deg, #0f1623, #0b111c);
  padding: 24px;
}
.login-card {
  width: 100%; max-width: 400px; background: var(--panel);
  border-radius: 16px; box-shadow: var(--shadow-lg); overflow: hidden;
}
.login-card .head {
  padding: 30px 32px 22px; text-align: center;
  background: linear-gradient(135deg, var(--brand) 0%, #1fb567 100%); color: #fff;
}
.login-card .head .logo {
  width: 56px; height: 56px; border-radius: 15px; margin: 0 auto 14px;
  background: rgba(255,255,255,.18); display: grid; place-items: center; font-size: 28px;
}
.login-card .head h1 { font-size: 22px; font-weight: 800; }
.login-card .head p { opacity: .9; font-size: 13px; margin-top: 3px; }
.login-card .body { padding: 28px 32px 32px; }
.login-card .demo { margin-top: 18px; text-align: center; font-size: 12px; color: var(--ink-soft); }
.login-card .demo code { background: var(--panel-2); padding: 2px 6px; border-radius: 5px; font-weight: 700; }

/* ---------- Utilities ---------- */
.row { display: flex; gap: 12px; align-items: center; }
.between { justify-content: space-between; }
.muted { color: var(--ink-soft); }
.mt { margin-top: 18px; }
.grid-2 { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }
.tamil { font-family: 'Noto Sans Tamil', sans-serif; }
@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
}
