:root {
  --bg: #101114;
  --panel: #17191e;
  --panel-2: #1f232b;
  --line: #2d3340;
  --text: #f3f5f8;
  --muted: #98a2b3;
  --accent: #ff6363;
  --accent-2: #ff8484;
  --success: #25b36a;
  --danger: #d64545;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Inter, Arial, sans-serif; background: var(--bg); color: var(--text); }
a { color: inherit; text-decoration: none; }
code { background: rgba(255,255,255,0.06); padding: 2px 6px; border-radius: 6px; }
.layout { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.sidebar { background: #0d0f13; border-right: 1px solid var(--line); padding: 28px 18px; position: sticky; top: 0; height: 100vh; }
.brand { font-size: 22px; font-weight: 800; margin-bottom: 20px; }
.nav { display: grid; gap: 8px; overflow: hidden; }
.nav-link { padding: 12px 14px; border-radius: 12px; color: var(--muted); }
.nav-link.active, .nav-link:hover { background: var(--panel); color: var(--text); }
.sidebar-user { margin-top: 24px; padding: 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; }
.user-name { font-weight: 700; margin: 6px 0; }
.content { padding: 28px; }
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.page-header.between { align-items: center; }
h1 { margin: 0 0 8px; font-size: 30px; }
.muted { color: var(--muted); }
.small-text { font-size: 12px; }
.no-margin { margin: 0; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 18px; box-shadow: 0 10px 30px rgba(0,0,0,0.18); }
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpis-six { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.kpi-value { font-size: 28px; font-weight: 800; margin-top: 8px; }
.grid.two { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 18px; }
.top-align { align-items: start; }
.section-title { font-size: 18px; font-weight: 700; margin-bottom: 12px; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { border-bottom: 1px solid var(--line); padding: 10px 8px; vertical-align: top; text-align: left; }
.table th { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .04em; }
.table.compact th, .table.compact td { padding: 10px 8px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
.form-stack { display: grid; gap: 12px; }
.row-form { display: flex; gap: 10px; flex-wrap: wrap; }
.row-form.wrap { align-items: center; }
label { display: grid; gap: 6px; font-size: 14px; }
input, select, textarea, button { font: inherit; }
input, select, textarea { width: 100%; background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
textarea { min-height: 110px; resize: vertical; }
.checkbox-row { display: flex; align-items: center; gap: 8px; padding-top: 26px; }
.checkbox-row input { width: auto; }
.button { background: var(--accent); color: white; border: none; border-radius: 12px; padding: 12px 16px; cursor: pointer; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.button.secondary { background: transparent; border: 1px solid var(--line); color: var(--text); }
.button.ghost { background: rgba(255,255,255,0.04); border: 1px solid var(--line); color: var(--text); }
.button.danger { background: var(--danger); }
.button.small { padding: 8px 10px; font-size: 13px; }
.button.full { width: 100%; }
.actions { display: flex; gap: 10px; justify-content: flex-start; }
.actions-inline, .approval-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.badge { display: inline-flex; align-items: center; padding: 6px 10px; border-radius: 999px; border: 1px solid var(--line); background: rgba(255,255,255,0.04); font-size: 12px; }
.badge.approved, .badge.paid { background: rgba(37,179,106,.14); border-color: rgba(37,179,106,.35); }
.row-paid td { background: rgba(37,179,106,.08); }
.row-rejected td { background: rgba(214,69,69,.08); }
.badge.rejected { background: rgba(214,69,69,.14); border-color: rgba(214,69,69,.35); }
.comments-list { display: grid; gap: 10px; }
.comment-item { padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel-2); }
.comment-head { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.flash { background: rgba(255,99,99,.14); border: 1px solid rgba(255,99,99,.4); color: #ffd2d2; padding: 12px 14px; border-radius: 14px; margin-bottom: 14px; }
.flash.error { background: rgba(214,69,69,.18); }
.login-page { display: grid; place-items: center; min-height: 100vh; }
.login-card { width: min(480px, calc(100vw - 32px)); background: var(--panel); border: 1px solid var(--line); border-radius: 24px; padding: 28px; }
.calendar-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.calendar-table { width: 100%; border-collapse: separate; border-spacing: 8px; table-layout: fixed; }
.calendar-table th { color: var(--muted); font-size: 13px; padding-bottom: 8px; }
.calendar-cell { background: var(--panel-2); border: 1px solid var(--line); border-radius: 16px; padding: 10px; min-height: 130px; vertical-align: top; }
.calendar-cell.other-month { opacity: 0.45; }
.calendar-cell.busy { border-color: rgba(255,99,99,.4); }
.calendar-day { font-weight: 700; margin-bottom: 10px; }
.calendar-items { display: grid; gap: 6px; }
.calendar-pill { display: block; background: rgba(255,99,99,.12); border: 1px solid rgba(255,99,99,.25); border-radius: 10px; padding: 6px 8px; font-size: 12px; }
.calendar-mini-list { display: grid; gap: 10px; }
.mini-list-item { display: grid; gap: 4px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel-2); }
.small-space { margin-top: 12px; }
.top-gap-half { margin-top: 6px; }
.top-gap { margin-top: 18px; }
.space-bottom { margin-bottom: 18px; }
.full { width: 100%; }
@media (max-width: 1200px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: relative; height: auto; }
  .grid.two, .form-grid { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .calendar-toolbar { flex-direction: column; align-items: stretch; }
  .calendar-table, .calendar-table tbody, .calendar-table tr, .calendar-table td { display: block; width: 100%; }
  .calendar-table thead { display: none; }
  .calendar-cell { min-height: auto; margin-bottom: 8px; }
}
@media (max-width: 640px) {
  .content { padding: 16px; }
  .kpis { grid-template-columns: 1fr; }
  .row-form { flex-direction: column; }
  .comment-head { flex-direction: column; }
}


.calendar-page-header { align-items: flex-start; }
.calendar-filter-form { display:flex; gap:12px; align-items:center; flex-wrap:wrap; }
.calendar-shell { padding: 0; overflow: hidden; }
.calendar-shell-header { display:flex; justify-content:space-between; align-items:center; padding: 20px 24px 16px; border-bottom:1px solid var(--line); }
.calendar-big-title { font-size: 22px; font-weight: 800; margin-bottom: 6px; }
.calendar-nav-actions { display:flex; align-items:center; gap: 10px; }
.calendar-nav-link, .calendar-today-link { display:inline-flex; align-items:center; justify-content:center; min-width:44px; height:44px; border-radius: 12px; border:1px solid var(--line); background: var(--panel-2); color: var(--text); }
.calendar-today-link { min-width: auto; padding: 0 16px; }
.calendar-weekdays-grid, .calendar-month-grid { display:grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.calendar-weekdays-grid { padding: 0 16px; background: rgba(255,255,255,0.02); }
.calendar-weekday { padding: 12px 10px; color: var(--muted); font-size: 13px; text-transform: lowercase; }
.calendar-month-grid { padding: 0 16px 16px; }
.calendar-month-cell { min-height: 155px; border-right:1px solid var(--line); border-bottom:1px solid var(--line); padding: 10px; background: transparent; }
.calendar-month-cell:nth-child(7n+1) { border-left:1px solid var(--line); }
.calendar-month-cell:nth-child(-n+7) { border-top:1px solid var(--line); }
.calendar-month-cell.other-month { opacity: .42; }
.calendar-month-cell.busy { background: rgba(255,255,255,0.015); }
.calendar-month-top { display:flex; justify-content:space-between; align-items:center; margin-bottom:10px; }
.calendar-day-number { font-size: 15px; font-weight: 700; }
.calendar-day-count { min-width: 28px; height: 28px; border-radius: 999px; display:inline-flex; align-items:center; justify-content:center; font-size: 12px; background: rgba(74,198,255,.2); border:1px solid rgba(74,198,255,.35); color: #b8ebff; }
.calendar-event-list { display:grid; gap:6px; }
.calendar-event-chip { display:block; font-size: 12px; line-height: 1.3; padding: 5px 8px; border-radius: 8px; background: rgba(255,99,99,.16); border: 1px solid rgba(255,99,99,.28); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.calendar-more-label { font-size: 12px; color: var(--muted); }

@media (max-width: 1280px) {
  .kpis-six { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .calendar-shell-header { flex-direction: column; align-items:flex-start; gap: 12px; }
  .calendar-weekdays-grid, .calendar-month-grid { grid-template-columns: 1fr; }
  .calendar-weekdays-grid { display:none; }
  .calendar-month-cell { min-height: auto; border-left:1px solid var(--line); margin-bottom: 8px; border-radius: 14px; }
  .kpis-six { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .kpis-six { grid-template-columns: 1fr; }
}

.kpis-eight { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stats-inline { display:flex; flex-wrap:wrap; gap:16px; }
.note-box { border:1px solid var(--line); background: rgba(255,255,255,.03); border-radius:14px; padding:12px 14px; }
.chips-list { display:grid; gap:10px; }
.participant-chip { display:flex; justify-content:space-between; gap:12px; align-items:center; border:1px solid var(--line); background: var(--panel-2); border-radius:14px; padding:12px 14px; }
.stacked-actions { align-items:flex-start; }
.inline-form-vertical { display:grid; gap:8px; width: 210px; }
.wide-form { width: 220px; }
.actions-inline form { margin:0; }
.table-calendar-shell { padding:0; overflow:hidden; }
.calendar-table-wrap { overflow-x:auto; }
.month-calendar-table { width:100%; min-width:980px; border-collapse:collapse; table-layout:fixed; }
.month-calendar-table th { text-transform: lowercase; font-size:13px; color:var(--muted); font-weight:700; padding:12px 10px; background: rgba(255,255,255,.02); border-bottom:1px solid var(--line); }
.month-calendar-table td { vertical-align:top; border:1px solid var(--line); padding:10px; height:155px; background:transparent; }
.month-calendar-cell.other-month { opacity:.42; }
.month-calendar-cell.busy { background: rgba(255,255,255,.02); }
.month-calendar-cell.today { box-shadow: inset 0 0 0 2px rgba(255,99,99,.45); background: rgba(255,99,99,.05); }
.month-calendar-dayline { display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom:10px; }
.month-calendar-day { font-size:15px; font-weight:800; }
.month-calendar-events { display:grid; gap:6px; }
.month-calendar-cell.today .month-calendar-day { color:#ffd6d6; }
.badge.paid { background: rgba(37,179,106,.14); border-color: rgba(37,179,106,.35); }
.row-paid td { background: rgba(37,179,106,.08); }
.row-rejected td { background: rgba(214,69,69,.08); }
.login-card { box-shadow: 0 18px 45px rgba(0,0,0,.26); }
.button { transition: transform .15s ease, opacity .15s ease, border-color .15s ease; }
.button:hover { transform: translateY(-1px); opacity: .98; }
input:focus, select:focus, textarea:focus { outline:none; border-color: rgba(255,99,99,.45); box-shadow: 0 0 0 3px rgba(255,99,99,.12); }
.table td a { text-decoration: none; }
@media (max-width: 1280px) {
  .kpis-eight { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .participant-chip { flex-direction:column; align-items:flex-start; }
  .inline-form-vertical, .wide-form { width:100%; }
}
@media (max-width: 640px) {
  .kpis-eight { grid-template-columns: 1fr; }
  .stats-inline { flex-direction:column; gap:8px; }
}


/* v6 responsive polish */
body { min-width: 320px; }
.layout { width: 100%; }
.sidebar { overflow-x: hidden; }
.brand { line-height: 1.15; }
.table-scroll { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; margin-top: 12px; }
.table-scroll:first-child { margin-top: 0; }
.table { min-width: 720px; }
.table.compact { min-width: 720px; }
.month-calendar-table { min-width: 920px; }
.section-title.between, .page-header .actions-inline { display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap; }
.page-header .actions-inline form, .actions-inline form { margin:0; }
.sidebar-user .button { margin-top: 12px; }
.nav { overflow-x: auto; }
.table-scroll::-webkit-scrollbar, .calendar-table-wrap::-webkit-scrollbar { height: 8px; }
.table-scroll::-webkit-scrollbar-thumb, .calendar-table-wrap::-webkit-scrollbar-thumb { background: rgba(255,255,255,.16); border-radius: 999px; }

@media (max-width: 1180px) {
  .layout { grid-template-columns: 220px 1fr; }
  .content { padding: 22px; }
  .kpi-value { font-size: 24px; }
}

@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: sticky;
    top: 0;
    z-index: 30;
    height: auto;
    padding: 14px 16px 12px;
    background: rgba(13,15,19,.96);
    backdrop-filter: blur(14px);
  }
  .brand { font-size: 18px; margin-bottom: 12px; }
  .nav {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    gap: 8px;
    padding-bottom: 4px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
  }
  .nav-link { white-space: nowrap; padding: 10px 12px; }
  .sidebar-user {
    margin-top: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
  }
  .sidebar-user .button.full { width: auto; }
  .content { padding: 18px 16px 24px; }
  .page-header, .page-header.between { flex-direction: column; align-items: stretch; }
  .page-header .actions-inline { width: 100%; }
  .page-header .actions-inline form, .page-header .actions-inline a, .page-header .actions-inline button { width: 100%; }
  .grid.two { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .kpis-eight { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .form-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  h1 { font-size: 24px; }
  .card { border-radius: 18px; padding: 14px; }
  .kpis, .kpis-six, .kpis-eight { grid-template-columns: 1fr; gap: 12px; }
  .kpi-value { font-size: 22px; }
  .table, .table.compact { min-width: 640px; }
  .month-calendar-table { min-width: 780px; }
  .calendar-shell-header { padding: 16px 16px 12px; }
  .calendar-nav-actions { width: 100%; justify-content: space-between; }
  .calendar-nav-link, .calendar-today-link { flex: 1; }
  .participant-chip, .comment-head, .actions, .actions-inline, .approval-actions { flex-direction: column; align-items: stretch; }
  .actions .button, .actions-inline .button, .actions-inline a, .actions-inline form, .approval-actions form { width: 100%; }
  .inline-form, .inline-form-vertical, .wide-form { width: 100%; }
  .stats-inline { flex-direction: column; gap: 8px; }
}

@media (max-width: 480px) {
  .sidebar { padding-inline: 12px; }
  .content { padding: 14px 12px 22px; }
  .card { padding: 12px; border-radius: 16px; }
  .button, input, select, textarea { border-radius: 10px; }
  .table, .table.compact { min-width: 560px; }
  .month-calendar-table { min-width: 700px; }
}

.file-stack { display: grid; gap: 8px; }
.file-stack a { text-decoration: none; }

.hidden-form { display:none; }
.drag-handle {
  cursor: grab;
  user-select: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 10px;
  background: rgba(255,255,255,.05);
  border: 1px solid var(--line);
  color: var(--muted);
}
tr.dragging { opacity: .5; }
.estimate-edit-row td { background: rgba(255,255,255,.02); }
.compact-form-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.pagination { display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap; }
.pagination-pages { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.page-pill, .page-gap {
  min-width: 38px;
  height: 38px;
  border-radius: 10px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border:1px solid var(--line);
  background: var(--panel-2);
}
.page-pill.active { background: rgba(255,99,99,.16); border-color: rgba(255,99,99,.3); }
.button.disabled { opacity: .45; pointer-events: none; }
.estimate-table .actions-inline { align-items:flex-start; }
@media (max-width: 980px) {
  .compact-form-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .compact-form-grid { grid-template-columns: 1fr; }
}

/* v9 compact filters + estimate editor */
.kpis-four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.dashboard-kpis { margin-bottom: 18px; }
.top-gap-xs { margin-top: 6px; }
.compact-filters-card { padding: 0; overflow: hidden; }
.filters-disclosure summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  cursor: pointer;
  font-weight: 700;
}
.filters-disclosure summary::-webkit-details-marker { display: none; }
.filters-disclosure[open] summary { border-bottom: 1px solid var(--line); }
.filters-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  padding: 16px 18px 18px;
}
.filters-grid .full { grid-column: 1 / -1; }
.filters-actions { display:flex; gap:10px; align-items:center; flex-wrap:wrap; }
.projects-top-grid { margin-top: 18px; }
.estimate-edit-row.is-hidden { display: none; }
.estimate-edit-form { padding-top: 8px; }
.estimate-table td { white-space: normal; }
.file-stack { display:grid; gap:6px; }
@media (max-width: 1280px) {
  .filters-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .filters-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpis-four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .filters-grid { grid-template-columns: 1fr; }
  .kpis-four { grid-template-columns: 1fr; }
}

/* v10 polish */
.accent-card {
  border-color: rgba(255,99,99,.28);
  background: linear-gradient(180deg, rgba(255,99,99,.06), rgba(255,255,255,0.01));
}
.table tbody tr { transition: background-color .16s ease, transform .16s ease; }
.table tbody tr:hover td { background: rgba(255,255,255,.045); }
.row-paid:hover td { background: rgba(37,179,106,.12); }
.row-rejected:hover td { background: rgba(214,69,69,.12); }
.section-title { letter-spacing: -.01em; }
.page-header p { max-width: 900px; line-height: 1.5; }
.file-stack a, .table a { text-decoration: underline; text-decoration-color: transparent; transition: text-decoration-color .15s ease, color .15s ease; }
.file-stack a:hover, .table a:hover { text-decoration-color: currentColor; color: #ffd2d2; }
.nav-link { transition: background-color .15s ease, color .15s ease, transform .15s ease; }
.nav-link:hover { transform: none; }
.badge { font-weight: 700; }
.muted.small-text { line-height: 1.4; }

.sidebar,
.nav-link { backface-visibility: hidden; }

@media (min-width: 981px) {
  .nav { overflow: hidden; }
}
