/* ===== MINIMAL LIGHT THEME ===== */
:root {
    --bg:        #fafafa;
    --surface:   #ffffff;
    --border:    #e5e7eb;
    --border-2:  #f3f4f6;
    --text:      #111827;
    --text-2:    #6b7280;
    --text-3:    #9ca3af;
    --accent:    #111827;
    --accent-h:  #000000;
    --green:     #047857;
    --red:       #b91c1c;
    --orange:    #b45309;
    --green-bg:  #ecfdf5;
    --red-bg:    #fef2f2;
    --orange-bg: #fffbeb;
    --gray-bg:   #f3f4f6;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}

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

/* ===== GLOBAL FORM CONTROLS — borderless filled, minimal ===== */
input, select, textarea, button {
    font-family: inherit;
    font-size: 13px;
    color: var(--text);
}

/* Base: all text-like inputs + select + textarea share the same skin */
input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="date"],
input[type="datetime-local"],
input[type="time"],
input[type="search"],
input[type="url"],
input[type="tel"],
textarea,
select {
    width: 100%;
    background: var(--gray-bg);          /* subtle filled */
    border: 1px solid transparent;       /* invisible until focus */
    color: var(--text);
    padding: 7px 12px;
    height: 34px;
    border-radius: 6px;
    font-size: 13px;
    line-height: 1.3;
    transition: background 0.12s, border-color 0.12s, box-shadow 0.12s;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

textarea {
    height: auto;
    min-height: 80px;
    padding: 9px 12px;
    line-height: 1.5;
    resize: vertical;
}

/* Hover: slightly darker background */
input[type="text"]:hover,
input[type="password"]:hover,
input[type="email"]:hover,
input[type="number"]:hover,
input[type="date"]:hover,
input[type="datetime-local"]:hover,
input[type="time"]:hover,
input[type="search"]:hover,
input[type="url"]:hover,
input[type="tel"]:hover,
textarea:hover,
select:hover {
    background: #ebedf0;
}

/* Focus: white bg, dark border, subtle ring */
input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
input[type="datetime-local"]:focus,
input[type="time"]:focus,
input[type="search"]:focus,
input[type="url"]:focus,
input[type="tel"]:focus,
textarea:focus,
select:focus {
    outline: none;
    background: var(--surface);
    border-color: var(--text);
    box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.08);
}

input::placeholder, textarea::placeholder {
    color: var(--text-3);
}

/* Custom select arrow — small subtle chevron */
select {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
    cursor: pointer;
}

select:focus {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%23111827' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'/%3e%3c/svg%3e");
}

/* Native option list (dropdown overlay) — light styling where browsers allow */
select option {
    background: var(--surface);
    color: var(--text);
    padding: 8px;
}

/* Date picker icon — subtle */
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator {
    opacity: 0.4;
    cursor: pointer;
    padding: 0;
    transition: opacity 0.12s;
}
input[type="date"]:hover::-webkit-calendar-picker-indicator,
input[type="datetime-local"]:hover::-webkit-calendar-picker-indicator,
input[type="time"]:hover::-webkit-calendar-picker-indicator {
    opacity: 0.8;
}

/* Number input — hide spinners */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input[type="number"] {
    -moz-appearance: textfield;
}

/* Checkbox — minimal square with checkmark */
input[type="checkbox"] {
    width: 16px;
    height: 16px;
    border: 1.5px solid var(--border);
    border-radius: 4px;
    background: var(--surface);
    cursor: pointer;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    position: relative;
    margin: 0;
    flex-shrink: 0;
    transition: all 0.12s;
}

input[type="checkbox"]:hover {
    border-color: var(--text-3);
}

input[type="checkbox"]:checked {
    background: var(--accent);
    border-color: var(--accent);
}

input[type="checkbox"]:checked::after {
    content: "";
    position: absolute;
    left: 4px;
    top: 1px;
    width: 5px;
    height: 9px;
    border: solid var(--surface);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

input[type="checkbox"]:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.12);
}

/* Radio — minimal circle */
input[type="radio"] {
    width: 16px;
    height: 16px;
    border: 1.5px solid var(--border);
    border-radius: 50%;
    background: var(--surface);
    cursor: pointer;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    position: relative;
    margin: 0;
    flex-shrink: 0;
    transition: all 0.12s;
}

input[type="radio"]:hover {
    border-color: var(--text-3);
}

input[type="radio"]:checked {
    border-color: var(--accent);
}

input[type="radio"]:checked::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    transform: translate(-50%, -50%);
}

input[type="radio"]:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.12);
}

/* Disabled */
input:disabled, select:disabled, textarea:disabled {
    background: var(--gray-bg);
    color: var(--text-3);
    cursor: not-allowed;
    opacity: 0.6;
}

/* Autofill — keep our background, override Chrome yellow */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px var(--gray-bg) inset !important;
    -webkit-text-fill-color: var(--text) !important;
    transition: background-color 5000s ease-in-out 0s;
}
input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 30px var(--surface) inset !important;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 24px;
}

/* ===== HEADER ===== */
.header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.header-right {
    display: flex;
    gap: 12px;
    align-items: center;
    color: var(--text-2);
    font-size: 13px;
}

/* ===== STATS ===== */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 16px;
}

.stat-card .label {
    color: var(--text-2);
    font-size: 12px;
    font-weight: 500;
}

.stat-card .value {
    font-size: 24px;
    font-weight: 600;
    margin-top: 4px;
    letter-spacing: -0.02em;
    color: var(--text);
}

/* ===== TOOLBAR ===== */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    gap: 12px;
    flex-wrap: wrap;
}

.toolbar form {
    display: flex;
    gap: 8px;
    flex: 1;
    max-width: 600px;
    align-items: center;
}

.toolbar input[type="text"] {
    flex: 2;
}

.toolbar select {
    flex: 1;
    min-width: 140px;
}

.toolbar .btn {
    height: 34px;
    padding: 0 14px;
}

/* ===== BUTTONS ===== */
.btn {
    background: var(--accent);
    color: var(--surface);
    border: 1px solid var(--accent);
    padding: 0 14px;
    height: 34px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
    line-height: 1;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
    white-space: nowrap;
}

.btn:hover {
    background: var(--accent-h);
    color: var(--surface);
    text-decoration: none;
}

.btn-sm {
    height: 26px;
    padding: 0 10px;
    font-size: 12px;
    border-radius: 5px;
}

.btn-secondary {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--gray-bg);
    color: var(--text);
    border-color: var(--text-3);
}

.btn-danger {
    background: var(--surface);
    color: var(--red);
    border: 1px solid var(--border);
}

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

.btn-success {
    background: var(--surface);
    color: var(--green);
    border: 1px solid var(--border);
}

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

.btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.15);
}

/* ===== TABLE ===== */
.table-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 32px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    text-align: left;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-2);
    font-size: 13px;
    vertical-align: middle;
}

th {
    background: var(--surface);
    color: var(--text-2);
    font-weight: 500;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--border);
}

tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--bg); }

.actions {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.actions form { display: inline; }

/* ===== BADGES ===== */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    text-transform: lowercase;
    letter-spacing: 0.02em;
    border: 1px solid transparent;
}

.badge.green   { background: var(--green-bg);  color: var(--green);  }
.badge.red     { background: var(--red-bg);    color: var(--red);    }
.badge.orange  { background: var(--orange-bg); color: var(--orange); }
.badge.gray    { background: var(--gray-bg);   color: var(--text-2); }

/* ===== FORMS ===== */
.form-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 28px 32px;
    max-width: 540px;
    margin: 0 auto;
}

.form-card h2 {
    margin-bottom: 24px;
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.form-group { margin-bottom: 16px; }

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 12px;
    color: var(--text-2);
    font-weight: 500;
}

.form-group textarea {
    resize: vertical;
    min-height: 72px;
}

.form-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-checkbox label {
    margin-bottom: 0;
    font-size: 13px;
    color: var(--text);
    cursor: pointer;
}

.form-actions {
    display: flex;
    gap: 8px;
    margin-top: 24px;
}

.error {
    background: var(--red-bg);
    border: 1px solid #fecaca;
    color: var(--red);
    padding: 10px 12px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 13px;
}

/* ===== LOGIN ===== */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.login-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 32px;
    width: 100%;
    max-width: 360px;
}

.login-card h1 {
    margin-bottom: 24px;
    text-align: center;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.login-card .btn {
    width: 100%;
}

/* ===== ACTIVITY LOG ===== */
.activity {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 4px 16px;
    max-height: 360px;
    overflow-y: auto;
}

.activity-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-2);
    font-size: 13px;
}

.activity-item:last-child { border-bottom: none; }

.activity-item > div:first-child {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.activity-item .ts {
    color: var(--text-3);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

.section-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-2);
    margin-bottom: 12px;
    font-weight: 600;
}

.muted { color: var(--text-2); }

.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-2);
    font-size: 13px;
}

/* ===== SCROLLBAR (subtle) ===== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* ===== UTILITIES ===== */
.tabular { font-variant-numeric: tabular-nums; }
