/* eMedia-inspired design tokens */
:root {
    --txt: #2a3445;
    --muted: #5c6578;
    --lightgrey: #f7f7f7;
    --orange: #f25e2a;
    --darkorange: #d8430d;
    --blue: #009fd9;
    --darkblue: #192743;
    --black: #121924;
    --card: #fff;
    --border: #dfdfdf;
    --success: #15803d;
    --danger: #b91c1c;
    --shadow: 0 15px 30px 2px rgba(29, 63, 121, 0.06);
    --radius: 8px;
    --radius-pill: 999px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: 'Poppins', system-ui, sans-serif;
    font-size: 15px;
    font-weight: 400;
    line-height: 1.7;
    color: var(--txt);
    background: var(--lightgrey);
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--orange);
    font-weight: 500;
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover { color: var(--darkorange); }

/* —— Header —— */
.topbar {
    background: var(--darkblue);
    color: #fff;
    box-shadow: 0 4px 20px rgba(18, 25, 36, 0.15);
}

.topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 64px;
	padding: 1.5rem 1.25rem 1.5rem !important;
}

.brand {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    line-height: 0;
}

.brand:hover { opacity: 0.92; }

.brand-logo {
    display: block;
    height: 44px;
    width: auto;
    max-width: 100%;
}

.brand-logo--login {
    height: 56px;
    margin: 0 auto;
}

.topbar nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 1.25rem;
}

.topbar nav a {
    color: rgba(255, 255, 255, 0.82);
    font-weight: 500;
    font-size: 0.9rem;
    padding: 0.35rem 0;
    border-bottom: 2px solid transparent;
}

.topbar nav a:hover,
.topbar nav a.is-active {
    color: #fff;
    border-bottom-color: var(--orange);
}

/* —— Layout —— */
.container {
    max-width: 1080px;
    margin: 0 auto;
    padding: 1.5rem 1.25rem 3rem;
}

.page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.page-header h1 {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--black);
    letter-spacing: -0.02em;
    line-height: 1.25;
}

.page-header .lead,
.page-header + .lead,
.lead {
    margin: -0.75rem 0 1.25rem;
    color: var(--muted);
    font-size: 0.95rem;
}

.section-title {
    margin: 2rem 0 0.75rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--darkblue);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.section-title:first-of-type { margin-top: 0; }

.settings-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    margin: 0 0 1.25rem;
}

.settings-tabs {
    margin-bottom: 1.5rem;
}

.settings-tab-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin: 0 0 1rem;
    padding: 0.25rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.settings-tab {
    appearance: none;
    border: none;
    background: transparent;
    color: var(--muted);
    font-family: inherit;
    font-size: 0.92rem;
    font-weight: 500;
    padding: 0.55rem 1rem;
    border-radius: calc(var(--radius) - 2px);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.settings-tab:hover {
    color: var(--orange);
    background: rgba(242, 94, 42, 0.08);
}

.settings-tab.is-active {
    color: #fff;
    background: var(--orange);
}

.settings-tab-panel[hidden] {
    display: none;
}

.settings-nav a {
    font-size: 0.92rem;
    color: var(--muted);
}

.settings-nav a:hover {
    color: var(--orange);
}

form#notifications-form {
	margin-bottom: 20px;
}

.settings-section {
    margin-bottom: 1rem;
}

.settings-section .section-title {
    margin-top: 0;
}

.subsection-title {
    margin: 1.25rem 0 0.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--darkblue);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 0 1rem;
    font-weight: 500;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    margin: 0;
}

.reminder-days-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin: 0 0 0.85rem;
}

.reminder-day-row {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.reminder-day-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.reminder-day-input {
    width: 6.5rem;
    margin-bottom: 0 !important;
    padding: 0.65rem 0.85rem !important;
    text-align: left;
}

.reminder-day-hint {
    font-size: 0.85rem;
    line-height: 1.35;
}

.reminder-day-controls .btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    height: auto;
    padding: 0.2rem;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    transition: color 0.15s ease, background 0.15s ease;
    flex-shrink: 0;
}

.reminder-day-controls .btn-icon:hover:not(:disabled) {
    color: var(--danger);
    background: rgba(185, 28, 28, 0.08);
}

.reminder-day-controls .btn-icon:focus-visible {
    outline: none;
    color: var(--danger);
    box-shadow: 0 0 0 3px rgba(0, 159, 217, 0.15);
}

.reminder-day-controls .btn-icon:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

h2 {
    margin: 1.5rem 0 0.75rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--darkblue);
}

/* —— Cards —— */
.card {
    background: var(--card);
    border: 1px solid rgba(223, 223, 223, 0.8);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
}

.card-flush { padding-top: 0.75rem; }
.card-flush table { margin-bottom: 0; }

/* —— Buttons —— */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.55rem 1.35rem;
    border-radius: var(--radius-pill);
    border: 2px solid var(--orange);
    background: var(--orange);
    color: #fff !important;
    text-decoration: none;
    cursor: pointer;
    font: inherit;
    font-weight: 500;
    font-size: 0.9rem;
    line-height: 1.4;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.15s ease;
}

.btn:hover {
    background: var(--darkorange);
    border-color: var(--darkorange);
    color: #fff !important;
}

.btn-secondary {
    background: transparent;
    color: var(--txt) !important;
    border-color: var(--border);
}

.btn-secondary:hover {
    background: var(--lightgrey);
    border-color: #bfbfbf;
    color: var(--txt) !important;
}

.topbar .btn-secondary {
    color: #fff !important;
    border-color: rgba(255, 255, 255, 0.35);
    background: transparent;
}

.topbar .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: #fff;
    color: #fff !important;
}

.btn-danger {
    background: var(--danger);
    border-color: var(--danger);
}

.btn-danger:hover {
    background: #991b1b;
    border-color: #991b1b;
}

.btn-success {
    background: var(--success);
    border-color: var(--success);
}

.btn-success:hover {
    background: #166534;
    border-color: #166534;
}

.btn-sm {
    padding: 0.3rem 0.85rem;
    font-size: 0.8rem;
}

.btn-block {
    width: 100%;
    margin-top: 0.25rem;
}

/* —— Tables —— */
table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    text-align: left;
    padding: 0.75rem 0.65rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

thead th {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
    border-bottom-width: 2px;
}

tbody tr:hover { background: rgba(247, 247, 247, 0.7); }

tbody tr:last-child td { border-bottom: none; }

.table-supports th { font-size: 0.78rem; }

.table-supports .table-actions {
    text-align: right;
    white-space: nowrap;
}

.table-supports .table-actions .btn,
.table-supports .table-actions .inline-form {
    margin-left: 0.35rem;
}

.table-archive tbody tr { opacity: 0.85; }

/* —— Forms —— */
label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--darkblue);
}

label.muted-label {
    font-weight: 500;
    color: var(--muted);
    font-size: 0.85rem;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="email"],
input[type="url"],
textarea,
select {
    width: 100%;
    padding: 0.65rem 0.85rem;
    border: 1px solid #bfbfbf;
    border-radius: 6px;
    margin-bottom: 1rem;
    font: inherit;
    color: var(--txt);
    background: #fff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(0, 159, 217, 0.15);
}

textarea { min-height: 140px; resize: vertical; }

.form-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.form-row > div { flex: 1; min-width: 10rem; }

.checklist label {
    font-weight: 400;
    display: flex;
    gap: 0.65rem;
    align-items: flex-start;
    margin-bottom: 0.55rem;
    padding: 0.5rem 0.65rem;
    border-radius: 6px;
    transition: background 0.15s ease;
}

.checklist label:hover { background: var(--lightgrey); }

.checklist input[type="checkbox"] {
    width: 1.1rem;
    height: 1.1rem;
    margin-top: 0.2rem;
    accent-color: var(--orange);
}

.time-entry {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.time-entry-row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.time-entry-field {
    flex: 0 1 auto;
}

.time-entry-stat {
    text-align: right;
    min-width: 9.5rem;
}

.time-entry-stat .muted-label {
    display: block;
    margin-bottom: 0.35rem;
}

.time-entry-stat-value {
    display: block;
    font-size: 1.05rem;
    color: var(--darkblue);
}

.time-entry-stat-hint {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.78rem;
    line-height: 1.3;
}

.time-entry input[type="number"] {
    max-width: 220px;
    margin-bottom: 0;
}

/* —— Alerts —— */
.alert {
    padding: 0.85rem 1.1rem;
    border-radius: var(--radius);
    margin-bottom: 1.25rem;
    font-size: 0.92rem;
    border: 1px solid transparent;
}

.alert-success {
    background: #ecfdf3;
    color: var(--success);
    border-color: #bbf7d0;
}

.alert-error {
    background: #fef2f2;
    color: var(--danger);
    border-color: #fecaca;
}

.alert-warn {
    background: #fffbeb;
    color: #b45309;
    border-color: #fde68a;
}

/* —— Badges —— */
.badge {
    display: inline-block;
    padding: 0.2rem 0.65rem;
    border-radius: var(--radius-pill);
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--lightgrey);
    color: var(--txt);
}

.badge-warn { background: #faf5f3; color: #9a3412; }
.badge-info { background: #e0f2fe; color: #0369a1; }
.badge-ok { background: #dcfce7; color: var(--success); }
.badge-danger { background: #fee2e2; color: var(--danger); }
.badge-secondary { background: #e8ecf2; color: var(--darkblue); }

.badge-log-ok { background: #dcfce7; color: var(--success); }
.badge-log-partial { background: #fef3c7; color: #92400e; }
.badge-log-error { background: #fee2e2; color: var(--danger); }
.badge-log-skipped { background: #e8ecf2; color: var(--muted); }

.table-reminder-log {
    font-size: 0.88rem;
}

.table-reminder-log td:last-child {
    word-break: break-word;
}

.cron-example {
    margin: 0 0 0.85rem;
    padding: 0.85rem 1rem;
    background: #f0f4f8;
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow-x: auto;
    font-size: 0.82rem;
    line-height: 1.5;
}

.cron-example code {
    white-space: pre-wrap;
    word-break: break-all;
}

.nowrap { white-space: nowrap; }

/* —— Misc —— */
.muted { color: var(--muted); font-size: 0.7rem; }

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1.25rem;
    align-items: center;
}

.actions-support { align-items: center; }
.actions-support .actions-support-end { margin-left: auto; }

.card-support-actions {
    padding: 1rem 1.5rem;
}

.card-support-actions .actions {
    margin-top: 0;
}

.support-edit-form {
    position: relative;
}

.support-edit-form.is-busy .card {
    pointer-events: none;
    opacity: 0.72;
}

.form-busy-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: rgba(15, 23, 42, 0.45);
}

.form-busy-overlay[hidden] {
    display: none !important;
}

.form-busy-panel {
    width: min(100%, 22rem);
    padding: 1.5rem 1.75rem;
    border-radius: var(--radius);
    background: var(--card);
    box-shadow: var(--shadow);
    text-align: center;
}

.form-busy-panel-wide {
    width: min(100%, 28rem);
}

.form-busy-panel p {
    margin: 0.75rem 0 0;
}

.form-busy-panel .muted {
    margin-top: 0.35rem;
    font-size: 0.85rem;
}

.sync-progress-label {
    margin: 0 0 1rem !important;
    font-weight: 500;
    color: var(--darkblue);
    line-height: 1.45;
}

.sync-progress-track {
    width: 100%;
    height: 0.65rem;
    border-radius: var(--radius-pill);
    background: var(--lightgrey);
    overflow: hidden;
}

.sync-progress-bar {
    height: 100%;
    width: 0;
    border-radius: var(--radius-pill);
    background: linear-gradient(90deg, var(--orange), #ff9a4d);
    transition: width 0.35s ease;
}

.sync-progress-percent {
    margin: 0.65rem 0 0 !important;
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--darkblue);
}

.btn.is-loading {
    position: relative;
    opacity: 0.85;
}

.checklist-header {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.65rem;
    margin-top: 1.25rem;
    margin-bottom: 0.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.checklist-header h2 {
    margin: 0;
    font-size: 1.05rem;
}

.form-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 1.5rem 0 1rem;
}

.inline-form { display: inline; }

.back-link {
    display: inline-block;
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
}

.back-link::before {
    content: "← ";
    opacity: 0.7;
}

/* —— Login —— */
body.login-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: linear-gradient(145deg, var(--darkblue) 0%, var(--black) 55%, #1a2d4a 100%);
}

body.login-page main.container {
    flex: 1;
    display: flex;
	flex-direction: column;
	gap: 10px;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.25rem;
}

.login-box {
    width: 100%;
    max-width: 400px;
    margin: 0;
    padding: 2rem 2rem 1.75rem;
}

.login-box h1 {
    margin: 0 0 1.25rem;
    font-size: 1.5rem;
    color: var(--black);
}

.login-brand {
    text-align: center;
    margin-bottom: 1.75rem;
}

.password-wrapper {
    position: relative;
    margin-bottom: 1rem;
}

.password-wrapper input[type="password"],
.password-wrapper input[type="text"] {
    padding-right: 2.75rem;
    margin-bottom: 0;
}

.toggle-password {
    position: absolute;
    right: 0.6rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 0.25rem;
    cursor: pointer;
    color: var(--muted);
    display: flex;
    align-items: center;
    line-height: 1;
    border-radius: 4px;
    transition: color 0.15s ease;
}

.toggle-password:hover { color: var(--darkblue); }

.toggle-password .eye-hide { display: none; }

.site-footer {
    text-align: center;
    padding: 1rem;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.45);
}

/* —— Empty state —— */
.empty-state {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--muted);
}

.empty-state a { font-weight: 600; }

/* —— Responsive —— */
@media (max-width: 640px) {
    .topbar-inner { flex-direction: column; align-items: flex-start; padding: 0.75rem 0; }
    .topbar nav { gap: 0.75rem 1rem; }
    .page-header { flex-direction: column; align-items: flex-start; }
    .actions-support .actions-support-end { margin-left: 0; width: 100%; }
    th, td { padding: 0.55rem 0.4rem; font-size: 0.88rem; }
}
