/* ================================================================
   TAKURA TRUST — ADMIN PANEL STYLESHEET
   ================================================================ */

:root {
  --forest:    #0D3B2E;
  --forest-m:  #1A5C45;
  --forest-l:  #2E8B65;
  --gold:      #E8A020;
  --gold-l:    #F5C050;
  --sage:      #F0F7F4;
  --white:     #FFFFFF;
  --ink:       #1A1A2E;
  --ink-m:     #3D3D55;
  --ink-l:     #7A7A9A;
  --rule:      #E2E8E5;
  --red:       #E53E3E;
  --orange:    #DD6B20;
  --blue:      #2B6CB0;
  --green:     #276749;

  --sidebar-w: 260px;
  --header-h:  60px;
  --r:         8px;
  --r-lg:      16px;

  --shadow-xs: 0 1px 4px rgba(13,59,46,.06);
  --shadow-sm: 0 4px 16px rgba(13,59,46,.08);
  --shadow-md: 0 12px 40px rgba(13,59,46,.12);
}

/* ── RESET ───────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html  { font-size: 15px; }
body  {
  font-family: 'DM Sans', system-ui, sans-serif;
  background: #F5F7FA;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
img   { max-width: 100%; display: block; }
a     { color: inherit; text-decoration: none; }
ul    { list-style: none; }
h1,h2,h3,h4,h5 { font-family: 'DM Sans', system-ui, sans-serif; font-weight: 700; line-height: 1.3; }

/* ── ADMIN LAYOUT ────────────────────────────────────────────── */
.admin-layout { display: flex; min-height: 100vh; }

/* ── SIDEBAR ─────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--forest);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  z-index: 100;
  transition: transform 0.3s ease;
}
.sidebar-logo {
  padding: 1.5rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  border-bottom: 1px solid rgba(255,255,255,.07);
  flex-shrink: 0;
}
.sidebar-logo-mark {
  width: 44px; height: 44px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(255,255,255,.18);
}
.sidebar-logo-mark img { display: block; width: 44px; height: 44px; border-radius: 50%; }
.sidebar-logo-text { display: inline-flex; flex-direction: column; justify-content: center; }
.sidebar-logo-name { font-size: 1.32rem; font-weight: 700; color: var(--white); line-height: 1; font-family: 'Cormorant Garamond', Georgia, serif; white-space: nowrap; }
.sidebar-logo-sub  { font-size: 0.5rem; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; color: var(--gold); opacity: .9; margin-top: .26rem; line-height: 1; width: 100%; text-align: justify; text-align-last: justify; white-space: nowrap; }

.sidebar-nav { flex: 1; padding: 1.25rem 0.75rem; overflow-y: auto; }

.nav-section-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255,255,255,.3);
  padding: 1rem 0.75rem 0.4rem;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.62rem 0.9rem;
  border-radius: var(--r);
  color: rgba(255,255,255,.7);
  font-size: 0.87rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s;
  margin-bottom: 2px;
  text-decoration: none;
}
.nav-item:hover   { background: rgba(255,255,255,.08); color: var(--white); }
.nav-item.active  { background: rgba(232,160,32,.15);  color: var(--gold); }
.nav-item .icon   { width: 18px; text-align: center; font-size: 1rem; flex-shrink: 0; }
.nav-badge {
  margin-left: auto;
  background: var(--red);
  color: var(--white);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 100px;
}

.sidebar-footer {
  padding: 1.25rem;
  border-top: 1px solid rgba(255,255,255,.07);
  flex-shrink: 0;
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.75rem;
  border-radius: var(--r);
  background: rgba(255,255,255,.06);
}
.sidebar-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--gold);
  color: var(--forest);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.85rem;
  flex-shrink: 0;
}
.sidebar-user-name { font-size: 0.82rem; font-weight: 600; color: var(--white); line-height: 1.2; }
.sidebar-user-role { font-size: 0.7rem; color: rgba(255,255,255,.4); }
.sidebar-logout {
  margin-left: auto;
  background: none;
  border: none;
  color: rgba(255,255,255,.4);
  cursor: pointer;
  font-size: 1rem;
  transition: color 0.2s;
  text-decoration: none;
  display: flex; align-items: center;
}
.sidebar-logout:hover { color: var(--red); }

/* ── MAIN CONTENT ────────────────────────────────────────────── */
.admin-main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
}

/* ── TOP BAR ─────────────────────────────────────────────────── */
.topbar {
  height: var(--header-h);
  background: var(--white);
  border-bottom: 1px solid var(--rule);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-xs);
  flex-shrink: 0;
}
.topbar-left  { display: flex; align-items: center; gap: 1rem; min-width: 0; }
.topbar-title { font-size: 1rem; font-weight: 700; color: var(--ink); white-space: nowrap; }
.breadcrumb   {
  display: flex; align-items: center; gap: 0.3rem;
  font-size: 0.8rem; color: var(--ink-l);
  flex-wrap: wrap;
}
.breadcrumb a       { color: var(--forest); }
.breadcrumb-sep     { color: var(--rule); }
.topbar-right       { display: flex; align-items: center; gap: 0.75rem; flex-shrink: 0; }
.topbar-icon-btn {
  width: 36px; height: 36px;
  border-radius: var(--r);
  background: var(--sage);
  border: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  color: var(--ink-m);
  position: relative;
  transition: background 0.2s;
  text-decoration: none;
}
.topbar-icon-btn:hover  { background: var(--rule); }
.topbar-notif-count {
  position: absolute;
  top: -3px; right: -3px;
  background: var(--red);
  color: var(--white);
  width: 16px; height: 16px;
  border-radius: 50%;
  font-size: 0.6rem;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
}

/* ── PAGE BODY ───────────────────────────────────────────────── */
.admin-page { padding: 1.75rem; flex: 1; }
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
  gap: 1rem;
}
.page-header h1 { font-size: 1.5rem; color: var(--ink); font-family: 'Cormorant Garamond', Georgia, serif; font-weight: 600; }
.page-header p  { font-size: 0.85rem; color: var(--ink-l); margin-top: 0.2rem; }

/* ── DASHBOARD STAT CARDS ────────────────────────────────────── */
.dash-stats {
  display: grid;
  grid-template-columns: repeat(4,1fr);
  gap: 1rem;
  margin-bottom: 1.75rem;
}
.dash-stat {
  background: var(--white);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-xs);
  position: relative;
  overflow: hidden;
}
.dash-stat::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
}
.dash-stat.s-green::before { background: var(--green); }
.dash-stat.s-gold::before  { background: var(--gold);  }
.dash-stat.s-blue::before  { background: var(--blue);  }
.dash-stat.s-red::before   { background: var(--red);   }
.dash-stat-icon {
  width: 40px; height: 40px;
  border-radius: var(--r);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
  margin-bottom: 0.9rem;
}
.dash-stat-icon.g { background: rgba(39,103,73,.1); }
.dash-stat-icon.o { background: rgba(232,160,32,.1); }
.dash-stat-icon.b { background: rgba(43,108,176,.1); }
.dash-stat-icon.r { background: rgba(229,62,62,.1);  }
.dash-stat-num    { font-size: 1.9rem; font-weight: 700; color: var(--ink); line-height: 1; font-family: 'Cormorant Garamond', Georgia, serif; }
.dash-stat-lbl    { font-size: 0.78rem; color: var(--ink-l); margin-top: 0.25rem; }
.dash-stat-change { font-size: 0.75rem; color: var(--green); margin-top: 0.5rem; font-weight: 600; }

/* ── CARDS ───────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}
.card-header {
  padding: 1.1rem 1.5rem;
  border-bottom: 1px solid var(--rule);
  display: flex; align-items: center; justify-content: space-between;
}
.card-header h2  { font-size: 0.95rem; color: var(--ink); font-family: 'Cormorant Garamond', Georgia, serif; font-weight: 600; font-size: 1.1rem; }
.card-body       { padding: 1.5rem; }
.card-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--rule);
  background: #FAFAFA;
}

/* ── DATA TABLES ─────────────────────────────────────────────── */
.table-wrap  { overflow-x: auto; }
.data-table  { width: 100%; border-collapse: collapse; font-size: 0.84rem; }
.data-table th {
  text-align: left;
  padding: 0.75rem 1rem;
  border-bottom: 2px solid var(--rule);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-l);
  white-space: nowrap;
  background: #FAFAFA;
}
.data-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--rule);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td      { background: var(--sage); }
.data-table .actions         { display: flex; gap: 0.4rem; }

/* ── BADGES ──────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.22rem 0.65rem;
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  white-space: nowrap;
}
.badge-green  { background: rgba(39,103,73,.1);   color: var(--green); }
.badge-gold   { background: rgba(232,160,32,.12);  color: #A06010; }
.badge-blue   { background: rgba(43,108,176,.1);   color: var(--blue);  }
.badge-red    { background: rgba(229,62,62,.1);    color: var(--red);   }
.badge-grey   { background: rgba(122,122,154,.1);  color: var(--ink-l); }

/* ── ADMIN BUTTONS ───────────────────────────────────────────── */
.a-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.55rem 1.1rem;
  border-radius: var(--r);
  font-size: 0.83rem;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: all 0.18s;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1.3;
}
.a-btn-primary         { background: var(--forest); color: var(--white);  }
.a-btn-primary:hover   { background: var(--forest-m); }
.a-btn-gold            { background: var(--gold);   color: var(--forest); }
.a-btn-gold:hover      { background: var(--gold-l); }
.a-btn-outline         { background: transparent;   color: var(--forest); border-color: var(--forest); }
.a-btn-outline:hover   { background: var(--forest); color: var(--white);  }
.a-btn-danger          { background: transparent;   color: var(--red);    border-color: var(--red);    }
.a-btn-danger:hover    { background: var(--red);    color: var(--white);  }
.a-btn-icon            { padding: 0.45rem 0.6rem; }
.a-btn-sm              { padding: 0.35rem 0.75rem; font-size: 0.77rem; }
.a-btn-lg              { padding: 0.75rem 1.75rem; font-size: 0.9rem; }

/* ── ADMIN FORM FIELDS ───────────────────────────────────────── */
.form-grid             { display: grid; grid-template-columns: 1fr 1fr;           gap: 1.25rem; }
.form-grid.g3          { grid-template-columns: 1fr 1fr 1fr; }
.form-grid.g1          { grid-template-columns: 1fr; }
.form-full             { grid-column: 1 / -1; }
.admin-field           { margin-bottom: 0; }
.admin-field label     { display: block; font-size: 0.8rem; font-weight: 600; margin-bottom: 0.35rem; color: var(--ink-m); }
.admin-field label .req { color: var(--red); }
.admin-field input,
.admin-field select,
.admin-field textarea {
  width: 100%;
  padding: 0.65rem 0.9rem;
  border: 1.5px solid var(--rule);
  border-radius: var(--r);
  font-size: 0.88rem;
  background: var(--white);
  color: var(--ink);
  transition: border-color 0.2s;
  font-family: inherit;
}
.admin-field input:focus,
.admin-field select:focus,
.admin-field textarea:focus { outline: none; border-color: var(--forest); }
.admin-field textarea       { min-height: 100px; resize: vertical; }
.admin-field .hint          { font-size: 0.73rem; color: var(--ink-l); margin-top: 0.3rem; }
.admin-field.has-error input { border-color: var(--red); }
.admin-field .error-msg      { font-size: 0.73rem; color: var(--red); margin-top: 0.3rem; }

/* ── PROGRESS BARS ───────────────────────────────────────────── */
.progress-bar  { background: var(--rule); border-radius: 100px; height: 6px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 100px; transition: width 0.4s ease; }

/* ── TABS ────────────────────────────────────────────────────── */
.admin-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--rule);
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.admin-tab {
  padding: 0.7rem 1.25rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--ink-l);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.18s, border-color 0.18s;
  text-decoration: none;
  display: inline-block;
}
.admin-tab.active  { color: var(--forest); border-bottom-color: var(--forest); }
.admin-tab:hover   { color: var(--forest); }
.tab-content       { display: none; }
.tab-content.active { display: block; }

/* ── ALERTS ──────────────────────────────────────────────────── */
.alert {
  padding: 0.85rem 1.25rem;
  border-radius: var(--r);
  font-size: 0.87rem;
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  margin-bottom: 1.25rem;
  line-height: 1.5;
}
.alert-success { background: rgba(39,103,73,.1);   color: var(--green); }
.alert-warning { background: rgba(232,160,32,.1);  color: #A06010; }
.alert-danger  { background: rgba(229,62,62,.1);   color: var(--red);  }
.alert-info    { background: rgba(43,108,176,.1);  color: var(--blue); }
.alert a       { font-weight: 700; }

/* ── FILTER BAR ──────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}
.filter-bar input,
.filter-bar select {
  padding: 0.55rem 0.9rem;
  border: 1.5px solid var(--rule);
  border-radius: var(--r);
  font-size: 0.85rem;
  background: var(--white);
  color: var(--ink);
  font-family: inherit;
}
.filter-bar input:focus,
.filter-bar select:focus { outline: none; border-color: var(--forest); }
.filter-bar .search      { flex: 1; min-width: 200px; }

/* ── LOGIN PAGE ──────────────────────────────────────────────── */
body.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #0D3B2E 0%, #1A5C45 60%, #8B4513 100%);
}
.login-card {
  background: var(--white);
  border-radius: 24px;
  padding: 3rem;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 32px 80px rgba(0,0,0,.25);
}
.login-card h3      { font-size: 1.3rem; margin-bottom: 0.3rem; }
.login-card > p     { font-size: 0.85rem; color: var(--ink-l); margin-bottom: 2rem; }
.login-logo         { display: flex; align-items: center; gap: .7rem; margin-bottom: 2rem; }
.login-logo-mark {
  width: 44px; height: 44px;
  background: var(--gold);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; font-family: Georgia, serif; font-weight: 700;
  color: var(--forest);
}
.back-link          { display: block; text-align: center; margin-top: 1.5rem; font-size: 0.82rem; color: var(--ink-l); }
.back-link a        { color: var(--forest); font-weight: 600; }

/* ── FLASH MESSAGE ───────────────────────────────────────────── */
.flash-wrap { padding: 0 1.75rem; }

/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (max-width: 1100px) {
  .dash-stats { grid-template-columns: repeat(2,1fr); }
}
@media (max-width: 900px) {
  .sidebar        { transform: translateX(-100%); }
  .sidebar.open   { transform: translateX(0); }
  .admin-main     { margin-left: 0; }
  .dash-stats     { grid-template-columns: repeat(2,1fr); }
  .form-grid,
  .form-grid.g3   { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .admin-page     { padding: 1rem; }
  .dash-stats     { grid-template-columns: 1fr; }
  .topbar         { padding: 0 1rem; }
}

/* -- v1.5: shared layout helpers and smarter tables -- */
.hr-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr)); gap: 1.5rem; align-items: start; }
.data-table tbody tr:nth-child(even) td { background: #FBFCFB; }
.data-table tbody tr:hover td { background: var(--sage); }
.data-table td .cell-sub, .cell-sub { display: block; font-size: .76rem; color: var(--ink-l); margin-top: .15rem; font-weight: 400; line-height: 1.35; }
.data-table .empty-cell, .empty-cell { text-align: center; color: var(--ink-l); padding: 2rem 1rem !important; font-style: italic; }
.data-table .row-actions, .row-actions { white-space: nowrap; text-align: right; }
.data-table .row-actions form { display: inline-block; margin: 0; }
.data-table td:first-child, .data-table th:first-child { padding-left: 1.25rem; }
.data-table td:last-child, .data-table th:last-child { padding-right: 1.25rem; }
.data-table th { border-bottom: 2px solid var(--forest); }
.card .table-wrap { border-radius: 0 0 var(--radius, 12px) var(--radius, 12px); }
@media (max-width: 640px) { .data-table td, .data-table th { padding: .65rem .7rem; } }

/* v1.5: .admin-table shares the .data-table look */
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.84rem; }
.admin-table th { text-align: left; padding: .75rem 1rem; border-bottom: 2px solid var(--forest); font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-l); white-space: nowrap; background: #FAFAFA; }
.admin-table td { padding: .85rem 1rem; border-bottom: 1px solid var(--rule); vertical-align: middle; }
.admin-table tbody tr:nth-child(even) td { background: #FBFCFB; }
.admin-table tbody tr:hover td { background: var(--sage); }
.admin-table tr:last-child td { border-bottom: none; }
.admin-field label input[type=checkbox], .admin-field label input[type=radio] { width: auto; margin-right: .5rem; vertical-align: middle; }
.admin-field label:has(input[type=checkbox]) { display: flex; align-items: center; font-weight: 500; }

/* v1.6 budget breakdown */
.bd-proj{background:#fff;border:1px solid var(--border,#e5e7eb);border-left:4px solid var(--forest);border-radius:10px;padding:.8rem 1.1rem;margin-bottom:1.2rem}
.bd-bar{margin-bottom:1rem}.bd-bar-top{display:flex;justify-content:space-between;gap:1rem;flex-wrap:wrap;font-size:.86rem;margin-bottom:.3rem}.bd-bar-top span{color:var(--ink-l)}
.bd-track{height:9px;background:#e5e9e7;border-radius:100px;overflow:hidden}.bd-track i{display:block;height:100%;background:var(--forest);border-radius:100px}
.bd-sub{display:flex;gap:1.2rem;flex-wrap:wrap;font-size:.82rem;color:var(--ink-l)}.bd-sub strong{color:var(--forest)}
.bd-table{min-width:1240px;table-layout:fixed}.bd-table th.r,.bd-table td.r{text-align:right}
.bd-table td{vertical-align:top;padding:.5rem .4rem}.bd-table th{padding-left:.4rem;padding-right:.4rem}.bd-table input{width:100%;padding:.4rem .5rem;font-size:.82rem;border:1px solid #d5ddd8;border-radius:6px;background:#fff;box-sizing:border-box}
.bd-table input.r{text-align:right}

.bd-table td.r{white-space:nowrap;padding-top:.85rem}
.bd-table tfoot td{background:var(--sage);font-weight:700;color:var(--forest);border-top:2px solid var(--forest)}
.bd-total{display:flex;gap:2rem;flex-wrap:wrap;align-items:center;background:var(--forest);color:#fff;border-radius:12px;padding:1rem 1.4rem;font-size:.92rem}.bd-total span:first-child{font-weight:700;letter-spacing:.08em;font-size:.78rem;opacity:.8}.bd-total strong{font-size:1.05rem}
.bd-save{display:flex;gap:1rem;align-items:center;flex-wrap:wrap;margin:1rem 0 0;font-size:.82rem;color:var(--ink-l)}
@media print{.bd-page .filter-bar,.bd-page .page-header .a-btn,.bd-save,.bd-table button,.card:last-of-type form{display:none!important}.bd-table input{border:0;padding:0}}
