/* ===== AirMate web-app ===== */
:root {
    --brand: #00BF63;
    --brand-dark: #00A656;
    --brand-light: #33D687;
    --ink: #0A1428;
    --muted: #5A6B85;
    --line: #E3E9F2;
    --bg: #FFFFFF;
    --bg-alt: #F4F7FC;
    --bg-soft: #EAFAF1;
    --green: #2E9E5B;
    --orange: #E0622C;
    --red: #D33A3A;
    --radius: 14px;
    --shadow-sm: 0 4px 18px rgba(10, 20, 40, 0.06);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; color: var(--ink); background: var(--bg-alt); -webkit-font-smoothing: antialiased; }
.hidden { display: none !important; }
a { text-decoration: none; color: inherit; }

.logo-img { height: 100px; width: auto; display: block; }
.logo-img.logo-lg { height: 100px; margin: 0 auto; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; border-radius: 10px; font-weight: 600; font-size: 14.5px; cursor: pointer; border: 1.5px solid transparent; font-family: inherit; transition: background .15s, transform .15s; }
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-outline { border-color: var(--brand); color: var(--brand-dark); background: transparent; }
.btn-outline:hover { background: var(--bg-soft); }
.btn-ghost { color: var(--brand-dark); background: transparent; }
.btn-ghost:hover { background: var(--bg-soft); }
.btn-block { width: 100%; }
.btn:disabled { opacity: .6; cursor: default; transform: none; }

/* ===== Login ===== */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(900px 400px at 50% -10%, #DCF5E7 0%, var(--bg-alt) 60%); }
.login-card { width: 100%; max-width: 400px; background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 38px 34px; box-shadow: 0 20px 60px rgba(0,191,99,.12); }
.login-brand { display: flex; align-items: center; justify-content: center; margin-bottom: 24px; }
.login-card h1 { font-size: 24px; text-align: center; }
.login-sub { text-align: center; color: var(--muted); margin: 6px 0 26px; font-size: 15px; }
.login-card label { display: block; font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; margin-bottom: 6px; }
.login-card input { width: 100%; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 10px; font-size: 15px; font-family: inherit; margin-bottom: 16px; transition: border-color .15s; }
.login-card input:focus { outline: none; border-color: var(--brand); }
.login-error { color: var(--red); font-size: 14px; text-align: center; margin-top: 12px; min-height: 18px; }
.login-link { display: block; text-align: center; color: var(--brand-dark); font-weight: 600; font-size: 14px; margin-top: 20px; cursor: pointer; }
.login-link:hover { text-decoration: underline; }
.login-back { display: block; text-align: center; color: var(--muted); font-size: 14px; margin-top: 14px; }
.login-back:hover { color: var(--brand-dark); }

/* ===== App shell ===== */
.topbar { min-height: 64px; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 16px; padding: 8px 22px; position: sticky; top: 0; z-index: 30; }
.menu-toggle { display: none; background: none; border: none; font-size: 22px; cursor: pointer; color: var(--brand-dark); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }

.topsearch { position: relative; flex: 1; max-width: 440px; margin: 0 18px; }
.topsearch input { width: 100%; padding: 9px 14px; border: 1.5px solid var(--line); border-radius: 10px; font-size: 14px; font-family: inherit; }
.topsearch input:focus { outline: none; border-color: var(--brand); }
@media (max-width: 820px) { .topsearch { display: none; } }

.search-dd { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 14px 44px rgba(0,0,0,.16); max-height: 64vh; overflow: auto; z-index: 50; }
.search-dd .sd-group { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 11px 14px 4px; }
.search-dd .sd-item { display: flex; align-items: center; gap: 10px; padding: 9px 14px; cursor: pointer; }
.search-dd .sd-item:hover { background: var(--bg-soft); }
.search-dd .sd-empty { padding: 16px 14px; color: var(--muted); font-size: 14px; }

.user-chip { display: flex; align-items: center; gap: 10px; }
.user-avatar { width: 38px; height: 38px; border-radius: 10px; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 14px; }
.user-meta { display: flex; flex-direction: column; line-height: 1.25; }
.user-meta > span:first-child { font-weight: 600; font-size: 14px; }
.user-company { font-size: 12px; color: var(--muted); }

.app:not(.hidden) { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
.app-body { display: grid; grid-template-columns: 232px 1fr; flex: 1; min-height: 0; }
.sidebar { background: #fff; border-right: 1px solid var(--line); padding: 18px 14px; height: 100%; overflow-y: auto; }
.sidebar nav { display: flex; flex-direction: column; gap: 4px; height: 100%; }
.sidebar-bottom { margin-top: auto; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 10px; color: var(--muted); font-weight: 600; font-size: 15px; cursor: pointer; }
.nav-item:hover { background: var(--bg-soft); color: var(--brand-dark); }
.nav-item.active { background: var(--brand); color: #fff; }
.nav-item svg { width: 19px; height: 19px; flex-shrink: 0; }

.content { padding: 32px; overflow-y: auto; }

.crumbs { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; font-size: 14px; }
.crumbs a { color: var(--brand-dark); font-weight: 600; cursor: pointer; }
.crumbs a:hover { text-decoration: underline; }
.crumbs span { color: var(--muted); }

.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 26px; flex-wrap: wrap; gap: 12px; }
.page-head h1 { font-size: 27px; font-weight: 800; letter-spacing: -.3px; }
.page-head p { color: var(--muted); }

/* Stat cards */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 34px; }
.stat-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.stat-icon { width: 44px; height: 44px; border-radius: 11px; background: var(--bg-soft); display: grid; place-items: center; font-size: 21px; margin-bottom: 14px; }
.stat-value { font-size: 32px; font-weight: 800; color: var(--brand-dark); letter-spacing: -1px; }
.stat-label { color: var(--muted); font-size: 14px; }

/* Lists / cards */
.section-title { font-size: 13px; font-weight: 700; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; margin-bottom: 14px; }
.list { display: flex; flex-direction: column; gap: 10px; }
.row-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; display: flex; align-items: center; gap: 14px; cursor: pointer; transition: box-shadow .15s, transform .15s; }
.row-card:hover { box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.row-icon { width: 42px; height: 42px; border-radius: 11px; background: var(--bg-soft); display: grid; place-items: center; font-size: 19px; flex-shrink: 0; }
.row-main { flex: 1; min-width: 0; }
.row-title { font-weight: 700; font-size: 15px; }
.row-sub { color: var(--muted); font-size: 13px; }
.row-tag { font-size: 12px; font-weight: 700; padding: 5px 12px; border-radius: 999px; white-space: nowrap; }
.tag-green { background: #DCF3E4; color: var(--green); }
.tag-orange { background: #FCE6D9; color: var(--orange); }
.tag-red { background: #FBE0E0; color: var(--red); }

.search-input { width: 100%; padding: 12px 16px; border: 1.5px solid var(--line); border-radius: 11px; font-size: 15px; font-family: inherit; margin-bottom: 18px; transition: border-color .15s; }
.search-input:focus { outline: none; border-color: var(--brand); }

.count-pill { font-size: 12.5px; font-weight: 700; padding: 6px 13px; border-radius: 999px; background: var(--bg-soft); color: var(--brand-dark); white-space: nowrap; }

.empty { text-align: center; color: var(--muted); padding: 50px 20px; }
.loading { text-align: center; color: var(--muted); padding: 50px 20px; }
.placeholder { background: #fff; border: 1px dashed var(--line); border-radius: var(--radius); padding: 60px 20px; text-align: center; color: var(--muted); }

.row-actions { display: flex; gap: 6px; }
.icon-btn { background: none; border: none; cursor: pointer; font-size: 17px; padding: 6px 8px; border-radius: 8px; color: var(--muted); }
.icon-btn:hover { background: var(--bg-soft); color: var(--brand-dark); }
.btn-sm { padding: 8px 14px; font-size: 13.5px; }

/* Forms */
.form label { display: block; font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; margin: 14px 0 6px; }
.form input, .form select, .form textarea { width: 100%; padding: 11px 13px; border: 1.5px solid var(--line); border-radius: 10px; font-size: 15px; font-family: inherit; transition: border-color .15s; }
.form input:focus, .form select:focus, .form textarea:focus { outline: none; border-color: var(--brand); }
.form textarea { resize: vertical; min-height: 70px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.form-error { color: var(--red); font-size: 14px; margin-top: 10px; min-height: 18px; }

/* Detail rows */
.detail-row { display: flex; justify-content: space-between; gap: 16px; padding: 11px 0; border-bottom: 1px solid var(--bg-alt); font-size: 15px; }
.detail-row .k { color: var(--muted); }
.detail-row .v { font-weight: 600; text-align: right; }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(10,20,40,.45); display: grid; place-items: center; z-index: 1500; padding: 20px; }
.modal { background: #fff; border-radius: 18px; width: 100%; max-width: 460px; max-height: 90vh; overflow: auto; box-shadow: 0 30px 80px rgba(0,0,0,.3); }
.modal.wide { max-width: 880px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 22px 24px 14px; }
.modal-head h2 { font-size: 20px; }
.modal-close { background: none; border: none; font-size: 28px; line-height: 1; cursor: pointer; color: var(--muted); }
.modal-close:hover { color: var(--ink); }
.modal-body { padding: 0 24px 24px; }

/* Toast */
.toast { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 13px 22px; border-radius: 12px; font-weight: 600; font-size: 14.5px; z-index: 1600; box-shadow: 0 10px 30px rgba(0,0,0,.25); }

/* Responsive */
@media (max-width: 820px) {
    .app-body { grid-template-columns: 1fr; }
    .sidebar { position: fixed; top: 64px; left: 0; bottom: 0; width: 232px; z-index: 25; transform: translateX(-100%); transition: transform .2s; }
    .sidebar.open { transform: translateX(0); }
    .menu-toggle { display: block; }
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .user-meta { display: none; }
}
@media (max-width: 480px) {
    .stat-grid { grid-template-columns: 1fr; }
    .content { padding: 20px; }
}
