:root {
    --dark-teal: #025158;
    --teal: #028d86;
    --black: #141414;
    --white: #ffffff;
    --bg: #f4f6f6;
    --card-bg: #ffffff;
    --border: #e1e6e6;
    --text-muted: #6b7a7b;
    --status-blue: #2e7bd6;
    --status-orange: #e08a1e;
    --status-green: #28a879;
    --danger: #c0392b;
    --sidebar-w: 240px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, Arial, sans-serif;
    background: var(--bg);
    color: var(--black);
    font-size: 14px;
}

a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Layout shell ---------- */

.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    background: #012e32;
    color: #fff;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; bottom: 0; left: 0;
    overflow-y: auto;
    z-index: 100;
    transition: transform .2s ease;
}

.sidebar .brand {
    padding: 18px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid #0c4a50;
}
.sidebar .brand img { height: 32px; }

.sidebar nav { padding: 10px 0; flex: 1; }
.sidebar nav a {
    display: block;
    padding: 11px 20px;
    color: #cfe9e7;
    font-size: 13.5px;
    border-left: 3px solid transparent;
}
.sidebar nav a:hover { background: #013e44; text-decoration: none; }
.sidebar nav a.active {
    background: var(--teal);
    color: #fff;
    border-left-color: #fff;
    font-weight: 600;
}
.sidebar nav .section-label {
    padding: 14px 20px 6px;
    font-size: 10.5px;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: #7fb9b5;
}

.sidebar .user-box {
    padding: 14px 16px;
    border-top: 1px solid #0c4a50;
    font-size: 12.5px;
}
.sidebar .user-box .name { font-weight: 600; color: #fff; }
.sidebar .user-box .role { color: #9fcfcb; }
.sidebar .user-box a { color: #ffb4b0; font-size: 12px; }

.menu-toggle {
    display: none;
    position: fixed;
    top: 10px; left: 10px;
    z-index: 200;
    background: var(--dark-teal);
    color: #fff;
    border: none;
    border-radius: 6px;
    width: 40px; height: 40px;
    font-size: 18px;
}

.main {
    margin-left: var(--sidebar-w);
    flex: 1;
    padding: 24px 28px 60px;
    width: calc(100% - var(--sidebar-w));
    min-width: 0;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}
.topbar h1 { font-size: 20px; margin: 0; color: var(--dark-teal); }

/* ---------- Cards / tables ---------- */

.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 18px;
    margin-bottom: 18px;
}

.kpi-row { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 20px; }
.kpi-card {
    background: #fff;
    border-left: 5px solid var(--teal);
    border-radius: 8px;
    padding: 14px 18px;
    min-width: 150px;
    flex: 1 1 150px;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.kpi-card .val { font-size: 26px; font-weight: 700; }
.kpi-card .lab { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

table.data-table { width: 100%; border-collapse: collapse; background: #fff; }
table.data-table th, table.data-table td {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    font-size: 13.5px;
    vertical-align: middle;
}
table.data-table th { color: var(--text-muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
table.data-table tr:hover td { background: #fafcfc; }

.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--border); border-radius: 10px; }
.table-wrap table.data-table { border: none; }

/* ---------- Badges / status dots ---------- */

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
}
.status-blue { background: var(--status-blue); }
.status-orange { background: var(--status-orange); }
.status-green { background: var(--status-green); }

.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.dot.status-blue { background: var(--status-blue); }
.dot.status-orange { background: var(--status-orange); }
.dot.status-green { background: var(--status-green); }

.pkg-badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 6px;
    font-size: 11.5px;
    font-weight: 600;
    background: #eef3f3;
    color: var(--dark-teal);
    border: 1px solid var(--border);
}

/* post status chips (social module), reused colors from the desktop app */
.pstatus { display:inline-block; padding:2px 8px; border-radius:6px; font-size:11px; font-weight:600; }
.pstatus-todo { background:#d9dfdf; color:#3a4747; }
.pstatus-done { background:#f2c230; color:#4a3900; }
.pstatus-sent_control { background:#8e5cd9; color:#fff; }
.pstatus-sent_publish { background: var(--teal); color:#fff; }
.pstatus-published { background: var(--status-green); color:#fff; }

/* ---------- Forms / buttons ---------- */

.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 18px; }
.form-grid.cols-1 { grid-template-columns: 1fr; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 12.5px; font-weight: 600; color: #39494a; }
.field .hint { font-size: 11.5px; color: var(--text-muted); }

input[type=text], input[type=password], input[type=email], input[type=date], input[type=number],
input[type=url], input[type=tel], input[type=file], select, textarea {
    font-family: inherit;
    font-size: 13.5px;
    padding: 9px 11px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: #fff;
    width: 100%;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(2,141,134,.15); }
textarea { resize: vertical; min-height: 70px; }

.checkbox-row { display: flex; align-items: center; gap: 8px; }
.checkbox-row input { width: auto; }

.btn {
    display: inline-block;
    padding: 9px 18px;
    border-radius: 7px;
    font-size: 13.5px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    text-align: center;
}
.btn:hover { text-decoration: none; filter: brightness(1.05); }
.btn-primary { background: var(--dark-teal); color: #fff; }
.btn-accent { background: var(--teal); color: #fff; }
.btn-ghost { background: #fff; color: var(--dark-teal); border: 1px solid var(--border); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 5px 12px; font-size: 12px; }

.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }

/* ---------- Misc ---------- */

.alert { padding: 11px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 13.5px; }
.alert-ok { background: #e3f6ee; color: #146c43; border: 1px solid #bfe9d4; }
.alert-error { background: #fdecea; color: #a4231a; border: 1px solid #f6c8c3; }
.alert-info { background: #e8f3fd; color: #0c5aa6; border: 1px solid #c6e0f8; }

.muted { color: var(--text-muted); }
.small { font-size: 12px; }
.section-title { font-size: 15px; font-weight: 700; margin: 0 0 12px; color: var(--dark-teal); }
.divider { border: none; border-top: 1px solid var(--border); margin: 18px 0; }

.filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; align-items: flex-end; }
.filters .field { min-width: 160px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; flex-wrap: wrap; }
.tabs a {
    padding: 9px 16px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
}
.tabs a.active { color: var(--dark-teal); border-bottom-color: var(--teal); }
.tabs a:hover { text-decoration: none; color: var(--dark-teal); }

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #012e32, var(--dark-teal) 60%, var(--teal));
    padding: 16px;
}
.login-card {
    background: #fff;
    border-radius: 14px;
    padding: 36px 32px;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 10px 40px rgba(0,0,0,.25);
    text-align: center;
}
.login-card img { height: 54px; margin-bottom: 18px; }
.login-card h1 { font-size: 17px; color: var(--dark-teal); margin: 0 0 20px; }
.login-card .field { text-align: left; margin-bottom: 14px; }
.login-card .btn { width: 100%; margin-top: 6px; }

/* ---------- Social planner overview grid ---------- */

.ov-wrap { overflow: auto; background: #fff; border: 1px solid var(--border); border-radius: 10px; max-height: 70vh; }
table.ov-grid { border-collapse: collapse; font-size: 11.5px; }
table.ov-grid th, table.ov-grid td { border: 1px solid #eef1f1; padding: 0; text-align: center; }
table.ov-grid th.name-col, table.ov-grid td.name-col {
    text-align: left; padding: 6px 10px; white-space: nowrap; position: sticky; left: 0; background: #fff; z-index: 2;
    font-weight: 500;
}
table.ov-grid th { background: #fafcfc; font-weight: 600; color: var(--text-muted); padding: 4px 2px; white-space: pre-line; position: sticky; top: 0; z-index: 3; }
table.ov-grid th.weekend, table.ov-grid td.weekend { background: #fbe4e4; }
table.ov-grid th.name-col { z-index: 4; }
.ov-cell { width: 26px; height: 26px; display: block; font-weight: 700; }
.ov-cell a { display:block; width:100%; height:100%; line-height:26px; color: inherit; }
.ov-cell a:hover { text-decoration: none; filter: brightness(0.95); }

/* ---------- Board cards (per-company month) ---------- */

.board-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.day-card { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 8px; min-height: 90px; }
.day-card .day-num { font-weight: 700; font-size: 13px; margin-bottom: 6px; }
.day-card .chip { display: block; padding: 3px 6px; border-radius: 5px; font-size: 11px; font-weight: 600; margin-bottom: 4px; }
.day-card.empty { background: #fafbfb; }
.day-card.today { border-top: 3px solid var(--teal); }

/* ---------- Responsive ---------- */

@media (max-width: 880px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main { margin-left: 0; width: 100%; padding: 64px 14px 40px; }
    .menu-toggle { display: block; }
    .form-grid { grid-template-columns: 1fr; }
    .kpi-card { min-width: 130px; }
}
