:root{
  --bg: #f6efef;
  --bg-2: #fdf9f9;
  --panel: #ffffff;
  --panel-soft: #fff7f7;
  --sidebar: #f4dddd;
  --sidebar-2: #efd2d2;
  --border: rgba(120, 40, 40, 0.12);
  --text: #161616;
  --text-soft: #3a3a3a;
  --muted: #6f6f6f;
  --accent: #dfa0a0;
  --accent-strong: #cf7f7f;
  --accent-soft: #f2c6c6;
  --danger: #cb5656;
  --warn: #cb9a4f;
  --success: #2f9767;
  --shadow: 0 10px 30px rgba(85, 40, 40, 0.08);
  --shadow-soft: 0 6px 18px rgba(80, 40, 40, 0.06);
  --radius: 18px;
  --radius-sm: 12px;
}

*{
  box-sizing:border-box;
}

html,body{
  margin:0;
  padding:0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: linear-gradient(180deg, var(--bg-2) 0%, var(--bg) 100%);
  color:var(--text);
}

body{
  min-width: 1200px;
}

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

button{
  font:inherit;
  cursor:pointer;
}

textarea.input{
  width:100%;
  resize:vertical;
  padding-top:10px;
  min-height:100px;
}

.admin-shell{
  display:grid;
  grid-template-columns: 280px 1fr;
  min-height:100vh;
}

.sidebar{
  border-right:1px solid var(--border);
  background: linear-gradient(180deg, var(--sidebar) 0%, var(--sidebar-2) 100%);
  padding:28px 20px;
  position:sticky;
  top:0;
  height:100vh;
}

.brand{
  display:flex;
  align-items:center;
  gap:14px;
  margin-bottom:32px;
}

.brand-badge{
  width:52px;
  height:52px;
  border-radius:16px;
  display:grid;
  place-items:center;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color:#fff;
  font-weight:800;
  font-size:1rem;
  box-shadow: 0 8px 22px rgba(207, 127, 127, 0.22);
}

.brand h2{
  margin:0;
  font-size:1.08rem;
  color:var(--text);
}

.brand p{
  margin:4px 0 0;
  color:#6a5858;
  font-size:.88rem;
}

.nav{
  display:flex;
  flex-direction:column;
  gap:10px;
}

.nav-link{
  padding:13px 15px;
  border-radius:14px;
  color:#5b4e4e;
  font-weight:500;
  transition:.18s ease;
}

.nav-link:hover,
.nav-link.active{
  background: rgba(255,255,255,0.68);
  color:#111;
  box-shadow: var(--shadow-soft);
}

.main{
  padding:30px;
}

.topbar{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:20px;
  margin-bottom:26px;
}

.topbar h1{
  margin:0;
  font-size:2rem;
  color:var(--text);
  letter-spacing:-0.02em;
}

.muted{
  color:var(--muted);
  margin-top:6px;
}

.topbar-actions{
  display:flex;
  align-items:center;
  gap:12px;
}

.admin-chip{
  padding:10px 14px;
  border-radius:999px;
  background:#fff;
  border:1px solid var(--border);
  color:#4d4d4d;
  box-shadow:var(--shadow-soft);
}

.btn{
  border:none;
  padding:11px 16px;
  border-radius:12px;
  background: var(--accent-strong);
  color:#fff;
  font-weight:600;
  transition:.18s ease;
  box-shadow: 0 6px 16px rgba(207, 127, 127, 0.16);
}

.btn:hover{
  transform:translateY(-1px);
  filter:brightness(1.02);
}

.btn-outline{
  background:#fff;
  border:1px solid var(--border);
  color:var(--text);
  box-shadow:none;
}

.btn-outline:hover{
  background:#fff4f4;
}

.btn-sm{
  padding:8px 11px;
  font-size:.84rem;
  border-radius:10px;
}

.cards-grid{
  display:grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap:20px;
  margin-bottom:26px;
}

.stat-card,
.panel{
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
}

.stat-card{
  padding:22px;
}

.stat-label{
  margin:0 0 12px;
  color:var(--muted);
  font-size:.92rem;
  font-weight:500;
}

.stat-card h3{
  margin:0;
  font-size:2.15rem;
  color:var(--text);
  letter-spacing:-0.03em;
}

.panel{
  padding:20px;
}

.panel-header{
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-bottom:14px;
}

.panel-header h2{
  margin:0;
  font-size:1.08rem;
  color:var(--text);
}

.empty-state{
  padding:22px;
  border:1px dashed rgba(207, 127, 127, 0.25);
  border-radius:14px;
  color:var(--muted);
  background:var(--panel-soft);
}

/* =========================
   FILTERS
========================= */

.filters-bar{
  display:grid;
  grid-template-columns: minmax(260px, 1.6fr) repeat(5, minmax(145px, 1fr));
  gap:12px;
  margin-bottom:18px;
}

.input,
.select{
  min-height:44px;
  border-radius:12px;
  border:1px solid rgba(120, 40, 40, 0.14);
  background:#fff;
  color:var(--text);
  padding:0 13px;
  outline:none;
}

.input::placeholder{
  color:#978888;
}

.input:focus,
.select:focus{
  border-color: rgba(207, 127, 127, 0.58);
  box-shadow: 0 0 0 3px rgba(223, 160, 160, 0.16);
}

/* =========================
   TABLE
========================= */

.table-wrap{
  width:100%;
  overflow:auto;
  border:1px solid var(--border);
  border-radius:16px;
  background:#fff;
}

table{
  width:100%;
  border-collapse:collapse;
  min-width:1240px;
}

th, td{
  text-align:left;
  padding:15px 12px;
  border-bottom:1px solid rgba(120, 40, 40, 0.08);
  vertical-align:top;
  color:var(--text);
}

th{
  color:#5d5d5d;
  font-size:.9rem;
  font-weight:700;
  background:#fff5f5;
  position:sticky;
  top:0;
  z-index:2;
}

tbody tr:hover{
  background:#fff8f8;
}

.cell-title{
  font-weight:600;
  color:var(--text);
}

.cell-sub{
  margin-top:4px;
  font-size:.82rem;
  color:var(--muted);
}

.mono{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size:.82rem;
  letter-spacing:.01em;
  word-break:break-word;
}

/* =========================
   STATUS CHIPS
========================= */

.status-pill,
.status-chip{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:6px 10px;
  border-radius:999px;
  font-size:.78rem;
  font-weight:700;
  white-space:nowrap;
  border:1px solid transparent;
}

.status-success,
.status-chip.success{
  background:rgba(47, 151, 103, .12);
  color:var(--success);
  border-color:rgba(47, 151, 103, .18);
}

.status-warn,
.status-chip.warning{
  background:rgba(203, 154, 79, .12);
  color:var(--warn);
  border-color:rgba(203, 154, 79, .18);
}

.status-danger,
.status-chip.danger{
  background:rgba(203, 86, 86, .12);
  color:var(--danger);
  border-color:rgba(203, 86, 86, .18);
}

.status-neutral,
.status-chip.neutral{
  background:rgba(120, 120, 120, .10);
  color:#555;
  border-color:rgba(120, 120, 120, .10);
}

/* =========================
   ACTIONS
========================= */

.row-actions,
.table-actions{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
}

.row-actions .btn,
.table-actions .btn{
  white-space:nowrap;
}

/* =========================
   DRAWER
========================= */

.drawer-backdrop{
  position:fixed;
  inset:0;
  background:rgba(40, 15, 15, .18);
  backdrop-filter:blur(4px);
  display:none;
  align-items:stretch;
  justify-content:flex-end;
  z-index:1000;
}

.drawer-backdrop.open{
  display:flex;
}

.drawer{
  width:min(760px, 100%);
  height:100%;
  background:#fffdfd;
  border-left:1px solid var(--border);
  padding:24px;
  overflow:auto;
  box-shadow:-16px 0 40px rgba(70, 30, 30, 0.12);
}

.drawer h2{
  margin-top:0;
  color:var(--text);
}

.drawer-header{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:16px;
  margin-bottom:18px;
}

.drawer-title{
  margin:0 0 6px;
}

.detail-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:14px;
  margin:16px 0 20px;
}

.detail-item,
.detail-card{
  background:#fff;
  border:1px solid var(--border);
  border-radius:14px;
  padding:12px;
}

.detail-card{
  padding:16px;
}

.detail-item label{
  display:block;
  color:var(--muted);
  font-size:.82rem;
  margin-bottom:6px;
}

.detail-card h4{
  margin:0 0 12px;
  font-size:.95rem;
  color:var(--text);
}

.detail-card p{
  margin:0 0 8px;
  color:var(--text-soft);
  line-height:1.45;
}

.detail-card p .status-chip{
  vertical-align:middle;
}

.detail-card-alert{
  border-color:rgba(203, 154, 79, .30);
  box-shadow:0 0 0 1px rgba(203, 154, 79, .08) inset;
  background:#fffaf2;
}

.detail-note-box{
  min-height:80px;
  padding:12px;
  border-radius:12px;
  background:#fff7f7;
  color:#444;
  white-space:pre-wrap;
  word-break:break-word;
}

td .muted{
  font-size:.82rem;
}

/* =========================
   OVERVIEW ISSUE CARDS
========================= */

.issues-list{
  display:grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap:14px;
}

.issue-card{
  display:block;
  padding:16px;
  border:1px solid var(--border);
  border-radius:14px;
  background:#fff;
  transition:.18s ease;
  box-shadow: var(--shadow-soft);
}

.issue-card:hover{
  transform:translateY(-1px);
  background:#fff9f9;
  border-color:rgba(207, 127, 127, .34);
}

.issue-card-top{
  margin-bottom:10px;
}

.issue-card-title{
  font-weight:700;
  margin-bottom:6px;
  color:var(--text);
}

.issue-card-subtitle{
  color:var(--muted);
  font-size:.92rem;
  margin-bottom:6px;
}

.issue-card-meta{
  color:#5a5a5a;
  font-size:.86rem;
  line-height:1.4;
}

/* =========================
   DESKTOP ONLY TUNING
========================= */

@media (max-width: 1280px){
  body{
    min-width: unset;
  }

  .filters-bar{
    grid-template-columns: repeat(3, minmax(160px, 1fr));
  }

  .filters-bar > :first-child{
    grid-column: 1 / -1;
  }
}

@media (max-width: 1100px){
  .cards-grid{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }
}

@media (max-width: 900px){
  .admin-shell{
    grid-template-columns:1fr;
  }

  .sidebar{
    position:relative;
    height:auto;
    border-right:none;
    border-bottom:1px solid var(--border);
  }

  .main{
    padding:18px;
  }

  .topbar{
    flex-direction:column;
    align-items:flex-start;
  }

  .cards-grid{
    grid-template-columns:1fr;
  }

  .detail-grid{
    grid-template-columns:1fr;
  }

  .filters-bar{
    grid-template-columns:1fr;
  }

  .drawer{
    width:100vw;
  }

  .issues-list{
    grid-template-columns:1fr;
  }
}

.filters-bar-compact{
  grid-template-columns: minmax(280px, 1.8fr) repeat(2, minmax(170px, 1fr));
}

.inquiry-text{
  white-space: pre-wrap;
  line-height: 1.45;
  min-width: 320px;
}


.panel-header-inline{
  margin-bottom: 16px;
}

.panel-actions{
  display:flex;
  align-items:center;
  gap:10px;
}

.compact{
  margin-top:4px;
}

.clickable-row{
  cursor:pointer;
  transition:background .16s ease, transform .16s ease;
}

.clickable-row:hover{
  background:#fff8f8;
}

.clickable-row:focus-visible{
  outline:2px solid var(--accent-strong);
  outline-offset:-2px;
}

.modal-backdrop{
  position:fixed;
  inset:0;
  background:rgba(30, 20, 20, 0.42);
  display:flex;
  align-items:center;
  justify-content:center;
  padding:24px;
  z-index:200;
}

.modal-backdrop.hidden{
  display:none;
}

.modal-card{
  width:min(760px, 100%);
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:24px;
  box-shadow:0 24px 60px rgba(40, 20, 20, 0.18);
  padding:24px;
}

.modal-card-lg{
  width:min(900px, 100%);
}

.modal-header{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:18px;
  margin-bottom:18px;
}

.icon-btn{
  width:40px;
  height:40px;
  border-radius:12px;
  border:1px solid var(--border);
  background:#fff;
  color:var(--text);
}

.icon-btn:hover{
  background:#fff4f4;
}

.modal-grid{
  display:grid;
  grid-template-columns:repeat(2, minmax(0, 1fr));
  gap:14px;
  margin-bottom:16px;
}

.detail-block{
  background:var(--panel-soft);
  border:1px solid var(--border);
  border-radius:16px;
  padding:14px 16px;
  margin-bottom:14px;
}

.detail-label{
  display:block;
  font-size:.8rem;
  font-weight:700;
  letter-spacing:.02em;
  text-transform:uppercase;
  color:#7a6666;
  margin-bottom:8px;
}

.detail-value{
  color:var(--text);
  font-weight:600;
  line-height:1.45;
}

.detail-message{
  white-space:pre-wrap;
  line-height:1.6;
  color:var(--text);
}

.modal-actions-wrap{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:16px;
  flex-wrap:wrap;
}

.modal-actions{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
}

.status-inline-group{
  min-width:220px;
}

.select-inline{
  min-width:220px;
}


/* =========================
   LOGIN PAGE FIXES
   Keeps dashboard colors intact, but forces the login screen
   to use a clean, high-contrast palette.
========================= */

body.login-page,
body.auth-page{
  min-width: 0;
  background:
    radial-gradient(circle at top, #fff7f7 0%, #f8efef 42%, #f1e6e6 100%);
  color: #1b1b1b;
}

.login-page .admin-shell,
.auth-page .admin-shell{
  display: block;
  min-height: 100vh;
}

.login-page .sidebar,
.auth-page .sidebar{
  display: none;
}

.login-page .main,
.auth-page .main{
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
}

.login-page .panel,
.auth-page .panel,
.login-page .login-card,
.auth-page .login-card,
.login-page .auth-card,
.auth-page .auth-card,
.login-page .login-box,
.auth-page .login-box,
.login-page .modal-card,
.auth-page .modal-card{
  width: min(520px, 100%);
  background: #ffffff;
  border: 1px solid rgba(120, 40, 40, 0.10);
  border-radius: 22px;
  box-shadow: 0 18px 45px rgba(55, 25, 25, 0.10);
  color: #1c1c1c;
}

.login-page h1,
.login-page h2,
.login-page h3,
.login-page h4,
.auth-page h1,
.auth-page h2,
.auth-page h3,
.auth-page h4{
  color: #181818;
}

.login-page p,
.login-page label,
.login-page .muted,
.login-page .cell-sub,
.auth-page p,
.auth-page label,
.auth-page .muted,
.auth-page .cell-sub{
  color: #5f5f5f;
}

.login-page .input,
.login-page .select,
.login-page input[type="email"],
.login-page input[type="password"],
.login-page input[type="text"],
.auth-page .input,
.auth-page .select,
.auth-page input[type="email"],
.auth-page input[type="password"],
.auth-page input[type="text"]{
  min-height: 48px;
  background: #fff;
  color: #171717;
  border: 1px solid rgba(120, 40, 40, 0.16);
  box-shadow: none;
}

.login-page .input::placeholder,
.login-page input::placeholder,
.auth-page .input::placeholder,
.auth-page input::placeholder{
  color: #8b7d7d;
}

.login-page .input:focus,
.login-page .select:focus,
.login-page input:focus,
.auth-page .input:focus,
.auth-page .select:focus,
.auth-page input:focus{
  border-color: rgba(207, 127, 127, 0.70);
  box-shadow: 0 0 0 4px rgba(223, 160, 160, 0.18);
}

.login-page .btn,
.auth-page .btn{
  background: linear-gradient(135deg, #cf7f7f, #bb6a6a);
  color: #fff;
  border: none;
  box-shadow: 0 10px 24px rgba(187, 106, 106, 0.18);
}

.login-page .btn:hover,
.auth-page .btn:hover{
  filter: brightness(1.03);
}

.login-page .btn-outline,
.auth-page .btn-outline{
  background: #fff;
  color: #2a2a2a;
  border: 1px solid rgba(120, 40, 40, 0.14);
  box-shadow: none;
}

.login-page .btn-outline:hover,
.auth-page .btn-outline:hover{
  background: #fff4f4;
}

.login-page .status-danger,
.login-page .status-chip.danger,
.login-page .error,
.login-page .alert-error,
.auth-page .status-danger,
.auth-page .status-chip.danger,
.auth-page .error,
.auth-page .alert-error{
  background: #fff1f1;
  color: #a33d3d;
  border: 1px solid rgba(203, 86, 86, 0.18);
  border-radius: 12px;
  padding: 10px 12px;
}

.login-page .status-success,
.login-page .status-chip.success,
.login-page .success,
.login-page .alert-success,
.auth-page .status-success,
.auth-page .status-chip.success,
.auth-page .success,
.auth-page .alert-success{
  background: #eefaf3;
  color: #24704e;
  border: 1px solid rgba(47, 151, 103, 0.18);
  border-radius: 12px;
  padding: 10px 12px;
}

.login-page a,
.auth-page a{
  color: #a35f5f;
}

.login-page a:hover,
.auth-page a:hover{
  color: #8d4d4d;
}

@media (max-width: 700px){
  .login-page .main,
  .auth-page .main{
    padding: 18px;
  }

  .login-page .panel,
  .auth-page .panel,
  .login-page .login-card,
  .auth-page .login-card,
  .login-page .auth-card,
  .auth-page .auth-card,
  .login-page .login-box,
  .auth-page .login-box,
  .login-page .modal-card,
  .auth-page .modal-card{
    border-radius: 18px;
  }
}
