/* Spruce Tree Media time tracker. Colours, type and radii follow the STM design system. */
:root {
    --navy-900: #0b243f;
    --navy-800: #123d68;
    --blue-600: #007bb9;
    --blue-500: #1496c8;
    --sky-400: #43ccf7;
    --sky-200: #caf5ff;
    --ice-100: #e1fbff;
    --page: #f6fbfd;
    --teal-500: #009fae;
    --white: #ffffff;
    --grey-200: #e4e9ee;
    --grey-600: #5b6b7c;

    --field: #eef7fa;
    --field-focus: #e1fbff;
    --success-bg: #dff3e7;
    --success-fg: #1d6b3d;
    --warning-bg: #fcefd9;
    --warning-fg: #8a5300;
    --danger-bg: #f9e1dc;
    --danger-fg: #a4341f;

    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 14px;
    --radius-pill: 999px;
    --shadow-xs: 0 1px 3px rgba(11, 36, 63, .08), 0 1px 2px rgba(11, 36, 63, .04);
    --shadow-sm: 0 2px 8px rgba(11, 36, 63, .10);
    --ring: 0 0 0 3px rgba(67, 204, 247, .55);
    --ease: cubic-bezier(.4, 0, .2, 1);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: "Mulish", "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--navy-800);
    background: var(--page);
}
a { color: var(--blue-600); }
a:hover { color: var(--navy-800); }
h1, h2, h3 { font-weight: 800; letter-spacing: -.01em; line-height: 1.18; margin: 0; }
h1 { font-size: 2rem; }
h2 { font-size: 1.25rem; margin-bottom: 12px; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 12px; }
.muted { color: var(--grey-600); }
.small { font-size: .875rem; }
.accent { color: var(--teal-500); }

/* Header */
.site-header { background: var(--white); color: var(--navy-800); box-shadow: 0 1px 3px rgba(11, 36, 63, .08); position: relative; z-index: 1; }
.site-header .inner { max-width: 1180px; margin: 0 auto; padding: 0 24px; min-height: 72px; display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.site-header .logo img { height: 40px; width: auto; display: block; }
.nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.nav a { color: var(--navy-800); text-decoration: none; font-weight: 700; font-size: .95rem; padding: 8px 11px; border-radius: var(--radius-sm); transition: background .22s var(--ease), color .22s var(--ease); }
.nav a:hover { color: var(--navy-900); background: var(--ice-100); }
.nav a.on { color: var(--white); background: var(--blue-600); }
.nav .count { display: inline-block; background: var(--sky-200); color: var(--navy-900); border-radius: var(--radius-pill); padding: 0 8px; margin-left: 6px; font-size: .78rem; }
.account { display: flex; align-items: center; gap: 14px; font-size: .9rem; color: var(--grey-600); }
.account a { color: var(--grey-600); font-weight: 700; }
.account a.current { color: var(--blue-600); }
.account button { background: none; border: 0; color: var(--navy-800); font: inherit; font-weight: 700; cursor: pointer; padding: 0; text-decoration: underline; }

main { max-width: 1180px; margin: 0 auto; padding: 36px 24px 72px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head .sub { color: var(--grey-600); margin-top: 6px; }

.site-footer { max-width: 1180px; margin: 0 auto; padding: 0 24px 40px; color: var(--grey-600); font-size: .85rem; }

/* Cards and layout */
.card { background: var(--white); border-radius: var(--radius-lg); padding: 24px; margin-bottom: 24px; box-shadow: var(--shadow-xs); }
.grid { display: grid; gap: 24px; }
.grid > * { min-width: 0; }
.grid.two { grid-template-columns: 1fr 1fr; }
.grid.side { grid-template-columns: 360px 1fr; align-items: start; }
.grid.three { grid-template-columns: repeat(3, 1fr); }
.grid.four { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .grid.two, .grid.side, .grid.three { grid-template-columns: 1fr; } .grid.four { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .grid.four { grid-template-columns: 1fr; } }

/* Forms: filled fields, no outlines until focus */
label { display: block; font-weight: 700; font-size: .9rem; margin-bottom: 6px; }
.field { margin-bottom: 16px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.row > * { min-width: 0; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], select, textarea {
    width: 100%; font: inherit; font-size: 1rem; color: var(--navy-800);
    background: var(--field); border: 0; border-radius: var(--radius-sm); padding: 10px 12px;
    transition: box-shadow .22s var(--ease), background .22s var(--ease);
}
input:focus, select:focus, textarea:focus { outline: 0; background: var(--field-focus); box-shadow: var(--ring); }
textarea { min-height: 96px; resize: vertical; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.check input { width: 18px; height: 18px; accent-color: var(--blue-600); }
.hint { font-size: .85rem; color: var(--grey-600); margin-top: 6px; }
.error-text { font-size: .85rem; color: var(--danger-fg); margin-top: 6px; font-weight: 600; }

.btn { display: inline-block; font: inherit; font-weight: 700; font-size: .95rem; border: 0; border-radius: var(--radius-sm); padding: 11px 20px; cursor: pointer; text-decoration: none; line-height: 1.2;
    background: var(--blue-600); color: var(--white); transition: background .22s var(--ease), transform .12s var(--ease); }
.btn:hover { background: var(--navy-800); color: var(--white); }
.btn:active { transform: scale(.98); }
.btn:focus-visible { outline: 0; box-shadow: var(--ring); }
.btn.secondary { background: var(--sky-200); color: var(--navy-800); }
.btn.secondary:hover { background: #b3ecfb; color: var(--navy-900); }
.btn.danger { background: var(--danger-bg); color: var(--danger-fg); }
.btn.danger:hover { background: #f3cdc4; }
.btn.small { padding: 6px 12px; font-size: .85rem; }
.btn[disabled] { background: var(--grey-200); color: #8a96a3; cursor: not-allowed; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
form.inline { display: inline; }

/* Messages */
.msg { padding: 12px 16px; border-radius: var(--radius-md); margin-bottom: 18px; font-weight: 600; background: var(--success-bg); color: var(--success-fg); }
.msg.warn { background: var(--warning-bg); color: var(--warning-fg); }
.msg.error { background: var(--danger-bg); color: var(--danger-fg); }
.msg.info { background: var(--sky-200); color: var(--navy-800); }
.msg ul { margin: 4px 0 0; padding-left: 18px; }

/* Tables */
.table-wrap { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; }
table.list th { text-align: left; font-size: .8rem; font-weight: 700; color: var(--grey-600); padding: 10px 12px; background: var(--field); white-space: nowrap; }
table.list th:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
table.list th:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
table.list td { padding: 12px; vertical-align: top; }
table.list tbody tr:nth-child(even) td { background: #f7fcfd; }
table.list td.nowrap, table.list .num { white-space: nowrap; }
table.list .num { text-align: right; }

.client-block { margin-bottom: 28px; }
.client-bar { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; background: var(--navy-800); color: var(--white); border-radius: var(--radius-md); padding: 10px 14px; margin-bottom: 8px; }
.client-bar strong { font-weight: 800; }
.client-bar span { color: #c3d4e3; font-size: .9rem; }
.task-title { font-weight: 700; }

.total-line { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px 16px; border-radius: var(--radius-md); background: var(--ice-100); font-weight: 800; }
.total-line.big { background: var(--navy-800); color: var(--white); font-size: 1.1rem; }

/* Audit log */
ul.changes { margin: 6px 0 0; padding-left: 18px; font-size: .875rem; color: var(--grey-600); }
ul.changes li { margin-bottom: 2px; }
ul.changes .old { text-decoration: line-through; }

/* Invoice look */
.logo-preview { background: var(--field); border-radius: var(--radius-md); padding: 14px; display: inline-block; max-width: 100%; }
.logo-preview img { display: block; max-height: 60px; max-width: 260px; }
.colour-row { display: flex; gap: 10px; align-items: center; }
.colour-row input[type=color] { width: 48px; height: 44px; padding: 3px; border: 0; border-radius: var(--radius-sm); background: var(--field); cursor: pointer; }
.colour-row input[type=text] { max-width: 140px; font-variant-numeric: tabular-nums; }
input[type=file] { font: inherit; font-size: .9rem; }

/* Task comments */
.comment { background: var(--field); border-radius: var(--radius-md); padding: 12px 14px; margin-bottom: 10px; }
.comment.mine { background: var(--ice-100); }
.comment-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.task h3 a { color: inherit; text-decoration: none; }
.task h3 a:hover { color: var(--blue-600); text-decoration: underline; }

/* Meetings */
.action-items { background: var(--ice-100); border-radius: var(--radius-md); padding: 12px 14px; }
.grid.two > div > .task { height: calc(100% - 14px); }
details.more summary { cursor: pointer; font-weight: 700; font-size: .9rem; color: var(--blue-600); }
.timer-card.running select, .timer-card.running input[type=text], .timer-card.running input[type=date], .timer-card.running input[type=number] { background: #1d4c7b; color: var(--white); color-scheme: dark; }
.timer-card.running select:focus, .timer-card.running input:focus { background: #235589; }

/* Timer */
.timer-card.running { background: var(--navy-800); color: var(--white); }
.timer-card.running h2 { color: var(--white); margin: 0; }
.timer-card.running label { color: var(--white); }
.timer-card.running .hint, .timer-card.running .muted { color: #c3d4e3; }
.timer-card.running textarea { background: #1d4c7b; color: var(--white); }
.timer-card.running textarea::placeholder { color: #9fb6cc; }
.timer-card.running textarea:focus { background: #235589; }
.timer-card.running .check input { accent-color: var(--sky-400); }
.timer-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.timer-clock { font-weight: 800; font-variant-numeric: tabular-nums; }
.timer-card .timer-clock { font-size: 1.9rem; color: var(--sky-400); line-height: 1; }
.timer-what { margin-bottom: 16px; }
.link-button { background: none; border: 0; padding: 0; margin-top: 14px; font: inherit; font-size: .9rem; font-weight: 700; color: #c3d4e3; text-decoration: underline; cursor: pointer; }
.link-button:hover { color: var(--white); }
.timer-pill { display: inline-flex; align-items: center; gap: 8px; background: var(--navy-800); color: var(--white); text-decoration: none; font-size: .9rem; padding: 6px 12px; border-radius: var(--radius-pill); }
.timer-pill:hover { color: var(--white); background: var(--blue-600); }
.timer-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--sky-400); animation: pulse 1.6s var(--ease) infinite; }
@keyframes pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .timer-pill .dot { animation: none; } }

/* Pills */
.pill { display: inline-block; font-size: .78rem; font-weight: 700; padding: 2px 10px; border-radius: var(--radius-pill); background: var(--grey-200); color: var(--grey-600); white-space: nowrap; }
.pill.ok { background: var(--success-bg); color: var(--success-fg); }
.pill.warn { background: var(--warning-bg); color: var(--warning-fg); }
.pill.bad { background: var(--danger-bg); color: var(--danger-fg); }
.pill.blue { background: var(--sky-200); color: var(--navy-800); }

/* Hour limit meters */
.meter { margin-bottom: 16px; }
.meter .top { display: flex; justify-content: space-between; gap: 8px; font-size: .9rem; font-weight: 700; margin-bottom: 6px; }
.bar { height: 8px; background: var(--grey-200); border-radius: var(--radius-pill); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--blue-600); border-radius: var(--radius-pill); }
.meter.warn .bar i { background: #e8a33d; }
.meter.full .bar i { background: #c8452f; }

/* Task cards */
.task { background: var(--white); border-radius: var(--radius-lg); padding: 18px 20px; margin-bottom: 14px; box-shadow: var(--shadow-xs); }
.task .head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.task .meta { display: flex; gap: 14px; flex-wrap: wrap; font-size: .875rem; color: var(--grey-600); margin: 6px 0 10px; }
.task .details { white-space: pre-line; margin-bottom: 12px; }

.month-nav { display: flex; align-items: center; gap: 10px; }
.month-nav strong { min-width: 150px; text-align: center; font-weight: 800; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 18px; }
.filters .field { margin: 0; min-width: 170px; }
.empty { color: var(--grey-600); padding: 12px 0; }
.stat { font-size: 1.75rem; font-weight: 800; line-height: 1.1; }

/* Sign in pages */
.auth-page { min-height: 100vh; display: flex; flex-direction: column; background: var(--page); }
.auth-page .center { flex: 1; display: flex; align-items: center; justify-content: center; padding: 40px 20px 20px; }
.auth-card { width: 100%; max-width: 440px; background: var(--white); border-radius: var(--radius-lg); padding: 36px; box-shadow: var(--shadow-sm); }
.auth-card .logo { display: block; width: 260px; max-width: 100%; margin: 0 auto 28px; }
.auth-card h1 { font-size: 1.6rem; margin-bottom: 6px; }
.ack { text-align: center; font-size: .82rem; color: var(--white); background: var(--navy-900); padding: 12px 20px; }

@media (max-width: 640px) {
    .site-header .inner { gap: 10px 16px; padding: 14px 16px; }
    .site-header .logo img { height: 32px; }
    .nav { order: 3; flex-basis: 100%; gap: 2px; }
    .nav a { padding: 7px 10px; font-size: .9rem; }
    .account { margin-left: auto; }
    main { padding: 24px 16px 56px; }
    .card { padding: 18px; }
    h1 { font-size: 1.6rem; }
    .row { grid-template-columns: 1fr; }
}

/* Mark paid, inline in the invoices table */
.pay-form { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.pay-form input { width: auto; min-width: 0; padding: 6px 8px; font-size: .85rem; }
.pay-form select { width: auto; min-width: 0; padding: 6px 28px 6px 8px; font-size: .85rem; }
