:root {
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #172033;
  background: #f4f7fb;
  font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: #f4f7fb; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.app-shell { max-width: 860px; margin: 0 auto; padding: 16px; }
.app-header {
  display: flex; justify-content: space-between; gap: 12px; align-items: center;
  padding: 18px; border-radius: 20px; background: linear-gradient(135deg, #0b57d0, #2575e6);
  color: white; box-shadow: 0 10px 30px rgba(11,87,208,.22);
}
.brand { display: flex; gap: 12px; align-items: center; }
.logo {
  width: 48px; height: 48px; border-radius: 14px; background: white; color: #0b57d0;
  display: grid; place-items: center; font-weight: 800;
}
h1 { font-size: 1.18rem; margin: 0; }
.subtitle { opacity: .88; font-size: .86rem; margin-top: 3px; }
.header-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.card {
  background: white; border: 1px solid #e5eaf2; border-radius: 18px;
  padding: 18px; margin-top: 14px; box-shadow: 0 6px 20px rgba(30,48,80,.06);
}
.card h2 { margin: 0 0 14px; font-size: 1.06rem; }
.clock { font-size: 2rem; font-weight: 800; letter-spacing: .02em; text-align: center; }
.date { text-align: center; color: #68738a; margin-top: 4px; }
.status-panel {
  border: 2px solid #d9e5fb; background: #f7faff; border-radius: 16px;
  padding: 16px; margin-top: 14px; text-align: center;
}
.status-panel.active { border-color: #1b8f5a; background: #effaf4; }
.status-title { font-weight: 800; }
.elapsed { font-size: 2.1rem; font-weight: 800; margin: 8px 0; font-variant-numeric: tabular-nums; }
.muted { color: #68738a; font-size: .9rem; }
.grid { display: grid; gap: 12px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
label { display: grid; gap: 6px; font-weight: 650; font-size: .91rem; }
input, select, textarea {
  width: 100%; border: 1px solid #ccd5e3; border-radius: 12px; padding: 12px;
  background: white; color: #172033;
}
input:focus, select:focus, textarea:focus {
  outline: 3px solid rgba(11,87,208,.13); border-color: #0b57d0;
}
.btn {
  border: 0; border-radius: 12px; padding: 11px 14px; font-weight: 750;
  display: inline-flex; justify-content: center; align-items: center; gap: 7px;
}
.btn-primary { background: #0b57d0; color: white; }
.btn-success { background: #168653; color: white; }
.btn-danger { background: #c73b3b; color: white; }
.btn-light { background: white; color: #0b57d0; }
.btn-soft { background: #eaf1fd; color: #0b57d0; }
.btn-neutral { background: #edf0f5; color: #253149; }
.btn:disabled { opacity: .48; cursor: not-allowed; }
.action-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.action-row .btn { flex: 1 1 150px; }
.summary-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px;
}
.metric { border-radius: 14px; padding: 14px; background: #f5f8fd; border: 1px solid #e1e8f3; }
.metric-label { color: #68738a; font-size: .82rem; }
.metric-value { font-size: 1.35rem; font-weight: 800; margin-top: 4px; }
.table-wrap { overflow-x: auto; border: 1px solid #e3e8f0; border-radius: 14px; }
table { width: 100%; border-collapse: collapse; min-width: 620px; }
th, td { padding: 11px 10px; border-bottom: 1px solid #e8edf4; text-align: left; font-size: .88rem; }
th { background: #f6f8fc; color: #556179; }
tr:last-child td { border-bottom: 0; }
.badge {
  display: inline-flex; align-items: center; border-radius: 999px; padding: 5px 9px;
  font-size: .78rem; font-weight: 750; background: #eaf1fd; color: #0b57d0;
}
.badge.closed { background: #eceff4; color: #4a556b; }
.notice {
  border-left: 4px solid #0b57d0; background: #f2f7ff; border-radius: 10px;
  padding: 11px 12px; color: #35425a; font-size: .89rem; margin: 10px 0;
}
.warning { border-left-color: #d07a00; background: #fff8e8; }
.danger-note { border-left-color: #c73b3b; background: #fff2f2; }
.hidden { display: none !important; }
.small { font-size: .82rem; }
.record-actions button { padding: 6px 9px; border-radius: 9px; border: 0; }
footer { text-align: center; color: #7b8598; font-size: .8rem; padding: 18px 0 30px; }
dialog {
  width: min(620px, calc(100% - 28px)); border: 0; border-radius: 18px; padding: 0;
  box-shadow: 0 24px 70px rgba(20,35,60,.3);
}
dialog::backdrop { background: rgba(20,28,45,.58); }
.dialog-body { padding: 20px; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.dialog-head h2 { margin: 0; }
.icon-btn { border: 0; background: #edf0f5; border-radius: 10px; padding: 8px 11px; }
.invoice-header { display: none; }
.print-only { display: none; }
.invoice-title { border-bottom: 2px solid #172033; padding-bottom: 10px; margin-bottom: 18px; }
.invoice-title h1 { margin: 0; font-size: 1.8rem; letter-spacing: .04em; }
.invoice-title p { margin: 5px 0 0; color: #556179; }
.invoice-meta { display: grid; gap: 7px; margin-bottom: 22px; font-size: .92rem; }
.invoice-table { width: 100%; border-collapse: collapse; margin-bottom: 20px; }
.invoice-table th, .invoice-table td {
  border: 1px solid #cfd6e2; padding: 8px; font-size: .78rem; vertical-align: top;
}
.invoice-table th { background: #f1f4f8; }
.invoice-totals { margin-left: auto; width: min(360px, 100%); border-top: 2px solid #172033; }
.invoice-totals div { display: flex; justify-content: space-between; gap: 20px; padding: 8px 0; }
.invoice-totals div:last-child { font-size: 1.08rem; }
.invoice-footnote { margin-top: 22px; font-size: .75rem; color: #667085; }
@media (max-width: 680px) {
  .app-shell { padding: 10px; }
  .app-header { align-items: flex-start; }
  .header-actions { flex-direction: column; }
  .grid-2, .grid-3, .summary-grid { grid-template-columns: 1fr; }
  .clock { font-size: 1.8rem; }
  .card { padding: 15px; }
}
@media print {
  body { background: white; }
  .app-shell { max-width: none; padding: 0; }
  .app-shell > * { display: none !important; }
  #invoiceDocument.print-only {
    display: block !important;
    width: 100%;
    color: #172033;
  }
  .invoice-table { page-break-inside: auto; }
  .invoice-table tr { page-break-inside: avoid; page-break-after: auto; }
}
.settings-section-title { margin: 20px 0 10px; font-size: 1rem; color: #0b57d0; }
.span-2 { grid-column: 1 / -1; }
#settingsDialog { width: min(820px, calc(100% - 28px)); }
.invoice-topline { display: flex; justify-content: space-between; gap: 30px; border-bottom: 3px solid #172033; padding-bottom: 16px; margin-bottom: 24px; }
.invoice-topline h1 { font-size: 2.1rem; letter-spacing: .08em; }
.invoice-topline p { margin: 6px 0 0; }
.invoice-dates { min-width: 260px; display: grid; gap: 8px; }
.invoice-dates div { display: flex; justify-content: space-between; gap: 20px; }
.invoice-dates span { color: #667085; }
.invoice-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; margin-bottom: 22px; }
.invoice-party { border: 1px solid #d7dee9; border-radius: 10px; padding: 14px; min-height: 130px; }
.invoice-party h2, .invoice-payment h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: #667085; margin: 0 0 8px; }
.invoice-party strong { font-size: 1rem; }
.invoice-lines { white-space: normal; margin-top: 5px; line-height: 1.45; }
.invoice-service { display: flex; gap: 14px; padding: 10px 12px; background: #f1f5fb; border-radius: 8px; margin-bottom: 18px; }
.invoice-service span { color: #667085; }
.invoice-days-table th:nth-child(n+2), .invoice-days-table td:nth-child(n+2) { text-align: right; }
.invoice-bottom { display: grid; grid-template-columns: 1fr minmax(280px, 360px); gap: 35px; align-items: start; margin-top: 24px; }
.invoice-payment { font-size: .86rem; }
.invoice-payment p { margin-top: 12px; }
.invoice-totals .amount-due { border-top: 2px solid #172033; margin-top: 4px; padding-top: 12px; font-size: 1.15rem; }
@media (max-width: 680px) {
  .span-2 { grid-column: auto; }
  .invoice-topline, .invoice-parties, .invoice-bottom { grid-template-columns: 1fr; display: grid; }
  .invoice-dates { min-width: 0; }
}
