/* PianoTuner Web UI */
:root{
    --bg:#0b1220;
    --bg-soft:#111827;
    --panel:#151f2e;
    --panel-2:#1f2937;
    --line:#2c3a4f;
    --text:#f8fafc;
    --muted:#9ca3af;
    --muted-2:#64748b;
    --blue:#60a5fa;
    --blue-2:#2563eb;
    --green:#34d399;
    --amber:#f59e0b;
    --red:#fb7185;
    --shadow:0 22px 70px rgba(0,0,0,.35);
    --radius:18px;
}

*{
    box-sizing:border-box;
}

body{
    margin:0;
    font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Arial,sans-serif;
    background:
        radial-gradient(circle at top left, rgba(37,99,235,.22), transparent 34rem),
        radial-gradient(circle at top right, rgba(52,211,153,.12), transparent 28rem),
        var(--bg);
    color:var(--text);
    min-height:100vh;
}

a{
    color:var(--blue);
    text-decoration:none;
}

a:hover{
/*    text-decoration:underline; */
}

.shell{
    width:min(1460px, calc(100% - 48px));
    margin:0 auto;
    padding:28px 0 48px;
}

.navbar{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:18px;
    margin-bottom:26px;
}

.brand{
    display:flex;
    align-items:center;
    gap:12px;
    color:var(--text);
}

.logo{
    width:42px;
    height:42px;
    display:grid;
    place-items:center;
    border-radius:14px;
    background:linear-gradient(135deg, var(--blue-2), #06b6d4);
    box-shadow:0 12px 30px rgba(37,99,235,.28);
    font-weight:900;
}

.brand-title{
    font-size:18px;
    font-weight:800;
    line-height:1.1;
}

.brand-subtitle{
    color:var(--muted);
    font-size:13px;
    margin-top:2px;
}

.navlinks{
    display:flex;
    align-items:center;
    gap:10px;
    flex-wrap:wrap;
}

.navlink,
.button{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    gap:8px;
    min-height:38px;
    padding:9px 14px;
    border:1px solid var(--line);
    border-radius:999px;
    color:#dbeafe;
    background:rgba(15,23,42,.62);
    font-size:14px;
    font-weight:700;
    text-decoration:none;
}

.navlink:hover,
.button:hover{
    background:rgba(37,99,235,.18);
    text-decoration:none;
}

.button-primary{
    border-color:rgba(96,165,250,.45);
    background:linear-gradient(135deg, rgba(37,99,235,.92), rgba(14,165,233,.72));
    color:white;
}

.button-danger{
    border-color:rgba(251,113,133,.32);
    color:#fecdd3;
}

.hero{
    display:grid;
    grid-template-columns:1.1fr .9fr;
    gap:20px;
    margin-bottom:22px;
}

.card{
    background:linear-gradient(180deg, rgba(21,31,46,.94), rgba(15,23,42,.94));
    border:1px solid rgba(148,163,184,.18);
    border-radius:var(--radius);
    box-shadow:var(--shadow);
}

.hero-card{
    padding:30px;
    min-height:210px;
    display:flex;
    flex-direction:column;
    justify-content:space-between;
}

.eyebrow{
    display:inline-flex;
    align-items:center;
    gap:8px;
    width:max-content;
    padding:7px 10px;
    border-radius:999px;
    background:rgba(96,165,250,.12);
    color:#bfdbfe;
    border:1px solid rgba(96,165,250,.22);
    font-size:12px;
    font-weight:800;
    letter-spacing:.04em;
    text-transform:uppercase;
}

h1{
    margin:16px 0 8px;
    font-size:clamp(30px, 4vw, 48px);
    line-height:1;
    letter-spacing:-.04em;
}

.lead{
    margin:0;
    color:var(--muted);
    max-width:720px;
    line-height:1.6;
}

.stats-card{
    padding:24px;
}

.stat-grid{
    display:grid;
    grid-template-columns:repeat(3, 1fr);
    gap:12px;
}

.stat{
    padding:18px;
    background:rgba(15,23,42,.72);
    border:1px solid rgba(148,163,184,.14);
    border-radius:16px;
}

.stat-value{
    display:block;
    font-size:28px;
    font-weight:900;
    color:white;
    margin-bottom:5px;
}

.stat-label{
    color:var(--muted);
    font-size:13px;
    font-weight:700;
}

.section-header{
    display:flex;
    justify-content:space-between;
    align-items:flex-end;
    gap:16px;
    margin:18px 0 14px;
}

.section-title{
    margin:0;
    font-size:26px;
    letter-spacing:-.02em;
}

.section-subtitle{
    color:var(--muted);
    margin:6px 0 0;
}

.table-card{
    overflow:hidden;
}

.table-wrap{
    width:100%;
    overflow:auto;
}

table{
    width:100%;
    border-collapse:separate;
    border-spacing:0;
    min-width:900px;
}

th,td{
    padding:15px 16px;
    text-align:left;
    border-bottom:1px solid rgba(148,163,184,.13);
    vertical-align:middle;
}

th{
    color:#cbd5e1;
    background:rgba(15,23,42,.72);
    font-size:12px;
    text-transform:uppercase;
    letter-spacing:.06em;
}

td{
    color:#e5e7eb;
    font-size:14px;
}

tbody tr:hover{
    background:rgba(96,165,250,.06);
}

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

.mono{
    font-family:"SFMono-Regular",Consolas,"Liberation Mono",monospace;
}

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

.empty{
    padding:42px;
    text-align:center;
    color:var(--muted);
}

.badge{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    width:max-content;
    min-height:26px;
    padding:4px 10px;
    border-radius:999px;
    font-size:12px;
    font-weight:900;
    color:white;
    background:#475569;
}

.badge-left,
.left{
    background:#2563eb;
}

.badge-center,
.center{
    background:#059669;
}

.badge-right,
.right{
    background:#b45309;
}

.badge-soft{
    color:#bfdbfe;
    background:rgba(96,165,250,.15);
    border:1px solid rgba(96,165,250,.2);
}

.actions{
    display:flex;
    gap:8px;
    align-items:center;
    flex-wrap:wrap;
}

.page-title-row{
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:16px;
    margin:12px 0 18px;
}

.back{
    display:inline-flex;
    align-items:center;
    gap:8px;
    margin-bottom:12px;
    color:#bfdbfe;
    font-weight:700;
}

.kpi-row{
    display:grid;
    grid-template-columns:repeat(3, minmax(0, 1fr));
    gap:14px;
    margin-bottom:18px;
}

.small-card{
    padding:18px;
}

.small-card-title{
    color:var(--muted);
    font-size:13px;
    font-weight:800;
    margin-bottom:8px;
}

.small-card-value{
    font-size:24px;
    font-weight:900;
}

.footer-note{
    margin-top:18px;
    color:var(--muted-2);
    font-size:13px;
}

@media (max-width: 900px){
    .shell{
        width:min(100% - 28px, 1460px);
        padding-top:18px;
    }

    .navbar,
    .hero,
    .section-header,
    .page-title-row{
        grid-template-columns:1fr;
        flex-direction:column;
        align-items:flex-start;
    }

    .hero{
        display:block;
    }

    .stats-card{
        margin-top:16px;
    }

    .stat-grid,
    .kpi-row{
        grid-template-columns:1fr;
    }

    h1{
        font-size:34px;
    }
}


/* Forms */
.form-card{
    padding:22px;
}

.form-grid{
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:16px;
}

.form-row{
    display:flex;
    flex-direction:column;
    gap:8px;
    margin-bottom:16px;
}

.form-row label{
    color:#cbd5e1;
    font-size:13px;
    font-weight:800;
}

input[type="text"],
input[type="number"],
textarea,
select{
    width:100%;
    border:1px solid var(--line);
    border-radius:14px;
    background:rgba(15,23,42,.74);
    color:var(--text);
    padding:12px 14px;
    font:inherit;
    outline:none;
}

textarea{
    min-height:180px;
    resize:vertical;
    font-family:"SFMono-Regular",Consolas,"Liberation Mono",monospace;
}

input:focus,
textarea:focus,
select:focus{
    border-color:rgba(96,165,250,.72);
    box-shadow:0 0 0 4px rgba(96,165,250,.12);
}

.form-actions{
    display:flex;
    align-items:center;
    gap:10px;
    flex-wrap:wrap;
    margin-top:18px;
}

.alert{
    padding:14px 16px;
    border-radius:14px;
    margin-bottom:18px;
    font-weight:700;
}

.alert-error{
    color:#fecdd3;
    background:rgba(251,113,133,.12);
    border:1px solid rgba(251,113,133,.28);
}

.alert-success{
    color:#bbf7d0;
    background:rgba(52,211,153,.10);
    border:1px solid rgba(52,211,153,.24);
}

.danger-zone{
    margin-top:22px;
    padding-top:18px;
    border-top:1px solid rgba(148,163,184,.13);
}

.inline-form{
    display:inline;
}

.header-meta{
    display:flex;
    align-items:center;
    gap:10px;
    flex-wrap:wrap;
}

.navlink.active{
    background:rgba(37,99,235,.26);
    color:#fff;
    border-color:rgba(96,165,250,.45);
}

.card-link{
    color:inherit;
    text-decoration:none;
}

.card-link:hover{
    text-decoration:none;
}

.metric-sub{
    color:var(--muted);
    font-size:13px;
    margin-top:4px;
}

@media (max-width: 900px){
    .form-grid{
        grid-template-columns:1fr;
    }
}





/* Auth pages */
.auth-page {
    min-height: 100vh;
    background:
        radial-gradient(circle at top left, rgba(45, 140, 255, 0.20), transparent 34rem),
        radial-gradient(circle at bottom right, rgba(57, 217, 138, 0.12), transparent 28rem),
        #07111f;
    color: #e7f1fb;
}

.auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 32px 18px;
}

.auth-card {
    width: min(440px, 100%);
    background: rgba(13, 28, 43, 0.92);
    border: 1px solid rgba(86, 120, 155, 0.28);
    border-radius: 24px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
    padding: 28px;
    backdrop-filter: blur(18px);
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 28px;
}

.auth-logo {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    border-radius: 16px;
    background: linear-gradient(135deg, #2d8cff, #39d98a);
    color: #ffffff;
    font-weight: 900;
    letter-spacing: -0.04em;
}

.auth-brand h1 {
    margin: 0;
    font-size: 20px;
    color: #ffffff;
}

.auth-brand p {
    margin: 3px 0 0;
    color: #8fa9c2;
    font-size: 13px;
}

.auth-header {
    margin-bottom: 22px;
}

.auth-header h2 {
    margin: 0 0 8px;
    font-size: 28px;
    color: #ffffff;
    letter-spacing: -0.04em;
}

.auth-header p {
    margin: 0;
    color: #8fa9c2;
    line-height: 1.45;
}

.auth-form {
    display: grid;
    gap: 16px;
}

.form-field {
    display: grid;
    gap: 8px;
}

.form-field label {
    color: #b9c8d8;
    font-size: 13px;
    font-weight: 700;
}

.form-field input {
    width: 100%;
    box-sizing: border-box;
    background: #091621;
    border: 1px solid #1d344a;
    border-radius: 14px;
    color: #ffffff;
    font-size: 15px;
    outline: none;
    padding: 13px 14px;
}

.form-field input:focus {
    border-color: #2d8cff;
    box-shadow: 0 0 0 3px rgba(45, 140, 255, 0.16);
}

.button-full {
    width: 100%;
    text-align: center;
    border: 0;
    cursor: pointer;
    font-weight: 800;
    margin-top: 4px;
}

.alert {
    border-radius: 14px;
    padding: 12px 14px;
    margin-bottom: 18px;
    font-weight: 700;
}

.alert-error {
    background: rgba(255, 107, 107, 0.13);
    border: 1px solid rgba(255, 107, 107, 0.28);
    color: #ffb4b4;
}

.auth-footer {
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid rgba(86, 120, 155, 0.18);
    display: flex;
    justify-content: center;
    gap: 8px;
    color: #8fa9c2;
}

.auth-footer a {
    color: #60a5fa;
    font-weight: 800;
    text-decoration: none;
}

.auth-footer a:hover {
/*    text-decoration: underline;*/
}

