:root {
  --sidebar: #103f30;
  --sidebar-deep: #0b3226;
  --green: #1d7651;
  --green-light: #eaf5ee;
  --blue: #178ba8;
  --ink: #1b3028;
  --muted: #6d7d76;
  --line: #dce6e1;
  --page: #f4f6f3;
  --white: #fff;
  --danger: #bc3d36;
  --warning: #b56f12;
  --shadow: 0 10px 35px rgba(20, 59, 45, .08);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { min-height: 100%; }
body { margin: 0; color: var(--ink); background: var(--page); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input, select, textarea { font: inherit; }
a { color: inherit; }
.admin-shell { min-height: 100vh; display: grid; grid-template-columns: 270px minmax(0, 1fr); }
.admin-sidebar { position: sticky; top: 0; align-self: start; height: 100vh; display: flex; flex-direction: column; padding: 27px 20px 20px; color: #fff; background: linear-gradient(180deg, var(--sidebar), var(--sidebar-deep)); }
.admin-brand { display: block; padding: 0 8px 24px; border-bottom: 1px solid rgba(255,255,255,.11); text-decoration: none; }
.admin-brand img { display: block; width: 205px; padding: 8px; border-radius: 12px; background: #fff; }
.admin-brand small { display: block; margin-top: 11px; color: rgba(255,255,255,.62); font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; }
.admin-nav { display: grid; gap: 6px; margin-top: 25px; }
.nav-link { display: flex; align-items: center; min-height: 50px; padding: 0 14px; gap: 12px; border-radius: 13px; color: rgba(255,255,255,.69); font-size: .92rem; font-weight: 700; text-decoration: none; }
.nav-link:hover, .nav-link.active { color: #fff; background: rgba(255,255,255,.11); }
.nav-icon { width: 25px; font-size: 1rem; text-align: center; }
.sidebar-footer { margin-top: auto; padding-top: 20px; border-top: 1px solid rgba(255,255,255,.11); }
.admin-user { margin: 0 0 14px; padding: 0 8px; }
.admin-user strong { display: block; font-size: .9rem; }
.admin-user span { color: rgba(255,255,255,.57); font-size: .76rem; }
.logout-button { width: 100%; min-height: 44px; border: 1px solid rgba(255,255,255,.18); border-radius: 12px; color: #fff; background: transparent; cursor: pointer; }
.logout-button:hover { background: rgba(255,255,255,.08); }
.admin-main { min-width: 0; padding: 32px clamp(22px, 4vw, 54px) 52px; }
.admin-topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 22px; margin-bottom: 26px; }
.page-title { margin: 0; color: #123e2f; font-size: clamp(1.75rem, 3vw, 2.5rem); letter-spacing: -.035em; }
.page-subtitle { margin: 7px 0 0; color: var(--muted); font-size: .93rem; }
.topbar-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 9px; }
.admin-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 0 16px; gap: 8px; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); background: #fff; font-size: .85rem; font-weight: 750; text-decoration: none; cursor: pointer; }
.admin-btn:hover { border-color: #9cb8aa; }
.admin-btn.primary { color: #fff; border-color: var(--green); background: var(--green); }
.admin-btn.danger { color: var(--danger); }
.admin-btn.small { min-height: 36px; padding: 0 11px; font-size: .77rem; }
.flash { margin: 0 0 20px; padding: 14px 17px; border-radius: 12px; font-size: .88rem; }
.flash.success { color: #145b38; border: 1px solid #b8ddc6; background: #ebf8ef; }
.flash.error { color: #8f2e28; border: 1px solid #e7b7b3; background: #fff0ef; }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 17px; }
.stat-card { min-height: 150px; padding: 22px; border: 1px solid var(--line); border-radius: 19px; background: #fff; box-shadow: var(--shadow); }
.stat-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stat-head span:first-child { color: var(--muted); font-size: .82rem; font-weight: 700; }
.stat-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; color: var(--green); background: var(--green-light); }
.stat-value { margin: 18px 0 4px; color: #123e2f; font-size: 2rem; font-weight: 850; letter-spacing: -.04em; }
.stat-foot { color: var(--muted); font-size: .77rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(320px, .7fr); gap: 18px; margin-top: 18px; }
.panel { overflow: hidden; border: 1px solid var(--line); border-radius: 19px; background: #fff; box-shadow: var(--shadow); }
.panel-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 68px; padding: 0 21px; border-bottom: 1px solid var(--line); }
.panel-header h2 { margin: 0; font-size: 1rem; }
.panel-header a { color: var(--green); font-size: .8rem; font-weight: 750; text-decoration: none; }
.panel-body { padding: 21px; }
.bar-chart { height: 270px; display: flex; align-items: flex-end; gap: 12px; padding-top: 16px; }
.bar-column { height: 100%; min-width: 0; flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 8px; }
.bar-value { color: var(--muted); font-size: .72rem; font-weight: 700; }
.bar-track { width: min(46px, 75%); min-height: 4px; border-radius: 9px 9px 3px 3px; background: linear-gradient(180deg, #42a878, var(--green)); transition: height .3s ease; }
.bar-label { color: var(--muted); font-size: .71rem; white-space: nowrap; }
.ranking { display: grid; gap: 15px; }
.ranking-row { display: grid; gap: 7px; }
.ranking-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: .8rem; }
.ranking-meta strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ranking-meta span { color: var(--muted); }
.ranking-track { overflow: hidden; height: 8px; border-radius: 99px; background: #edf1ef; }
.ranking-fill { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--blue), #51b0c3); }
.h0 { height: 0; } .h5 { height: 5%; } .h10 { height: 10%; } .h15 { height: 15%; } .h20 { height: 20%; }
.h25 { height: 25%; } .h30 { height: 30%; } .h35 { height: 35%; } .h40 { height: 40%; } .h45 { height: 45%; }
.h50 { height: 50%; } .h55 { height: 55%; } .h60 { height: 60%; } .h65 { height: 65%; } .h70 { height: 70%; }
.h75 { height: 75%; } .h80 { height: 80%; } .h85 { height: 85%; } .h90 { height: 90%; } .h95 { height: 95%; } .h100 { height: 100%; }
.w0 { width: 0; } .w5 { width: 5%; } .w10 { width: 10%; } .w15 { width: 15%; } .w20 { width: 20%; }
.w25 { width: 25%; } .w30 { width: 30%; } .w35 { width: 35%; } .w40 { width: 40%; } .w45 { width: 45%; }
.w50 { width: 50%; } .w55 { width: 55%; } .w60 { width: 60%; } .w65 { width: 65%; } .w70 { width: 70%; }
.w75 { width: 75%; } .w80 { width: 80%; } .w85 { width: 85%; } .w90 { width: 90%; } .w95 { width: 95%; } .w100 { width: 100%; }
.table-panel { margin-top: 18px; }
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: .84rem; }
.data-table th { padding: 13px 15px; color: #64766e; background: #f7f9f8; font-size: .72rem; letter-spacing: .05em; text-align: left; text-transform: uppercase; white-space: nowrap; }
.data-table td { padding: 14px 15px; border-top: 1px solid #edf1ef; vertical-align: middle; }
.data-table tbody tr:hover { background: #fbfdfc; }
.data-table a { color: #176d4c; font-weight: 750; text-decoration: none; }
.name-cell strong { display: block; }
.name-cell small { display: block; max-width: 250px; margin-top: 3px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status { display: inline-flex; align-items: center; min-height: 28px; padding: 0 9px; border-radius: 99px; font-size: .7rem; font-weight: 800; }
.status.arrived { color: #176848; background: #e5f5eb; }
.status.in_service { color: #17667c; background: #e5f4f7; }
.status.completed { color: #53655d; background: #edf1ef; }
.status.canceled { color: #9b3730; background: #faeae8; }
.empty-state { padding: 50px 20px; color: var(--muted); text-align: center; }
.filters { display: grid; grid-template-columns: minmax(180px, 1fr) repeat(3, minmax(140px, .45fr)) auto; gap: 10px; padding: 18px; border-bottom: 1px solid var(--line); }
.admin-input, .admin-select { width: 100%; min-height: 44px; padding: 0 13px; border: 1px solid #ccd9d2; border-radius: 11px; color: var(--ink); background: #fff; outline: 0; }
.admin-input:focus, .admin-select:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(29,118,81,.1); }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: .8rem; }
.page-links { display: flex; gap: 6px; }
.page-links a, .page-links span { display: grid; place-items: center; min-width: 35px; height: 35px; padding: 0 8px; border: 1px solid var(--line); border-radius: 9px; background: #fff; text-decoration: none; }
.page-links .active { color: #fff; border-color: var(--green); background: var(--green); }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; }
.info-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.info-item { min-height: 80px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.info-item:nth-child(odd) { border-right: 1px solid var(--line); }
.info-item.full { grid-column: 1 / -1; border-right: 0; }
.info-item small { display: block; margin-bottom: 6px; color: var(--muted); font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.info-item strong { font-size: .9rem; line-height: 1.45; word-break: break-word; }
.media-stack { display: grid; gap: 18px; }
.media-box { overflow: hidden; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: #fff; }
.media-box h3 { margin: 0 0 11px; font-size: .85rem; }
.media-box img { display: block; width: 100%; max-height: 300px; border-radius: 11px; object-fit: contain; background: #f4f6f5; }
.no-media { display: grid; place-items: center; height: 160px; color: var(--muted); border-radius: 11px; background: #f4f6f5; font-size: .8rem; }
.status-form { display: flex; gap: 8px; }
.settings-form { max-width: 680px; padding: 24px; }
.form-row { display: grid; gap: 8px; margin-bottom: 17px; }
.form-row label { font-size: .82rem; font-weight: 750; }
.form-row small { color: var(--muted); font-size: .75rem; }
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 70% 20%, rgba(23,139,168,.15), transparent 28rem), #eef3ef; }
.login-card { width: min(440px, 100%); padding: 35px; border: 1px solid var(--line); border-radius: 24px; background: #fff; box-shadow: 0 25px 70px rgba(16,63,48,.14); }
.login-card img { display: block; width: 250px; margin: 0 auto 26px; }
.login-card h1 { margin: 0; color: #123e2f; font-size: 1.65rem; text-align: center; }
.login-card > p { margin: 8px 0 25px; color: var(--muted); font-size: .85rem; text-align: center; }
.login-card .admin-btn { width: 100%; margin-top: 5px; }
.login-back { display: block; margin-top: 18px; color: var(--muted); font-size: .8rem; text-align: center; }
.menu-toggle { display: none; }
@media (max-width: 1100px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-grid, .detail-grid { grid-template-columns: 1fr; }
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters .admin-btn { width: 100%; }
}
@media (max-width: 780px) {
  .admin-shell { display: block; }
  .admin-sidebar { position: static; width: 100%; height: auto; padding: 15px; }
  .admin-brand { display: flex; align-items: center; justify-content: space-between; padding: 0; border: 0; }
  .admin-brand img { width: 175px; }
  .admin-brand small, .sidebar-footer { display: none; }
  .admin-nav { grid-template-columns: repeat(4, 1fr); margin-top: 13px; overflow-x: auto; }
  .nav-link { min-width: 105px; justify-content: center; padding: 0 10px; font-size: .76rem; }
  .nav-icon { display: none; }
  .admin-main { padding: 24px 14px 40px; }
  .admin-topbar { display: block; }
  .topbar-actions { justify-content: flex-start; margin-top: 16px; }
  .info-list { grid-template-columns: 1fr; }
  .info-item:nth-child(odd) { border-right: 0; }
}
@media (max-width: 560px) {
  .stats-grid, .filters { grid-template-columns: 1fr; }
  .stat-card { min-height: 132px; }
  .pagination { align-items: flex-start; flex-direction: column; }
  .login-card { padding: 27px 20px; }
}
@media print {
  .admin-sidebar, .topbar-actions, .filters, .pagination, .no-print { display: none !important; }
  .admin-shell { display: block; }
  .admin-main { padding: 0; }
  .panel { box-shadow: none; border: 1px solid #bbb; }
}

/* Login recovery + arithmetic CAPTCHA */
.admin-captcha { display: grid; grid-template-columns: 1fr 130px; align-items: center; gap: 12px; margin: 4px 0 14px; padding: 13px 14px; border: 1px solid #cfe0d7; border-radius: 12px; background: #f2f8f4; }
.admin-captcha > div { display: grid; gap: 3px; }
.admin-captcha small { color: var(--muted); font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.admin-captcha strong { color: #123e2f; font-size: 1.05rem; }
.admin-captcha .admin-input { min-height: 42px; text-align: center; font-weight: 800; }
.login-help { display: flex; justify-content: flex-end; margin: -3px 0 12px; }
.login-help a { color: var(--green); font-size: .8rem; font-weight: 750; text-decoration: none; }
.login-help a:hover { text-decoration: underline; }
.recovery-card { width: min(470px, 100%); }
.recovery-card .flash { margin-top: 18px; }
.link-button { width: 100%; margin-top: 12px; }

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

/* Administrator CRUD - guest records */
.row-actions { display: flex; align-items: center; gap: 12px; white-space: nowrap; }
.row-actions a + a { position: relative; }
.row-actions a + a::before { content: ''; position: absolute; left: -7px; top: 50%; width: 3px; height: 3px; border-radius: 50%; background: #a6b5ae; transform: translateY(-50%); }
.crud-panel { max-width: 1050px; }
.crud-form { padding: 0; }
.form-section { padding: 24px; border-bottom: 1px solid var(--line); }
.form-section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 22px; }
.form-section-head h2 { margin: 0; color: #173d30; font-size: 1.05rem; }
.form-section-head p { margin: 6px 0 0; color: var(--muted); font-size: .8rem; }
.record-code { flex: 0 0 auto; padding: 7px 10px; border-radius: 9px; color: #176848; background: #eaf5ee; font-size: .75rem; font-weight: 800; letter-spacing: .02em; }
.crud-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 17px 18px; }
.crud-grid .form-row { margin: 0; }
.crud-grid .form-row.full { grid-column: 1 / -1; }
.admin-textarea { min-height: 118px; padding-top: 12px; padding-bottom: 12px; resize: vertical; line-height: 1.5; }
.crud-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 20px 24px; }
.delete-panel { max-width: 760px; }
.delete-warning { display: flex; gap: 16px; padding: 24px; border-bottom: 1px solid var(--line); background: #fff8f7; }
.delete-warning h2 { margin: 0; color: #8f2e28; font-size: 1.08rem; }
.delete-warning p { margin: 6px 0 0; color: #7d5a57; font-size: .84rem; line-height: 1.5; }
.danger-icon { display: grid; place-items: center; flex: 0 0 42px; width: 42px; height: 42px; border-radius: 50%; color: #fff; background: var(--danger); font-size: 1.15rem; font-weight: 900; }
.delete-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-bottom: 1px solid var(--line); }
.delete-summary > div { min-height: 82px; padding: 16px 24px; border-bottom: 1px solid #edf1ef; }
.delete-summary > div:nth-child(odd) { border-right: 1px solid #edf1ef; }
.delete-summary small { display: block; margin-bottom: 5px; color: var(--muted); font-size: .7rem; font-weight: 750; text-transform: uppercase; letter-spacing: .05em; }
.delete-summary strong { display: block; word-break: break-word; }
.delete-form { padding-top: 6px; }
.confirm-check { display: flex; align-items: flex-start; gap: 10px; margin: 18px 24px 4px; color: #684844; font-size: .84rem; }
.confirm-check input { margin-top: 3px; }
.admin-btn.danger-solid { color: #fff; border-color: var(--danger); background: var(--danger); }
.admin-btn.danger-solid:hover { border-color: #922f2a; background: #a73530; }

@media (max-width: 780px) {
  .crud-grid, .delete-summary { grid-template-columns: 1fr; }
  .crud-grid .form-row.full { grid-column: auto; }
  .delete-summary > div:nth-child(odd) { border-right: 0; }
  .crud-actions { justify-content: stretch; }
  .crud-actions .admin-btn { flex: 1; }
}
