:root {
    font: 16px/1.5 system-ui, sans-serif;
    color: #1c312a;
    background: #f4f6f3;
}

* { box-sizing: border-box; }
body { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
button, a, input { outline-offset: 4px; }
h1 { margin: 0 0 1.25rem; line-height: 1.15; letter-spacing: -.035em; }

.brand { display: flex; align-items: center; gap: .7rem; font-weight: 700; }
.brand img { border-radius: 9px; }
.login-page { min-height: 100svh; display: grid; place-items: center; padding: 1.5rem; }
.login-card {
    width: min(100%, 27rem);
    background: white;
    padding: clamp(1.5rem, 5vw, 2.5rem);
    border: 1px solid #dce5df;
    border-radius: 16px;
    box-shadow: 0 16px 40px #142c260d;
}
.login-card h1 { margin-top: 1.75rem; font-size: 2rem; }
.login-form, .login-form label { display: grid; gap: .45rem; }
.login-form { gap: 1rem; }
.login-form label { font-weight: 600; }
.login-form input {
    min-width: 0;
    min-height: 46px;
    padding: .6rem .75rem;
    color: inherit;
    background: #fafbfa;
    border: 1px solid #a4b5ab;
    border-radius: 8px;
}
button {
    min-height: 44px;
    padding: .55rem .9rem;
    border: 1px solid transparent;
    border-radius: 8px;
    background: #255c47;
    color: white;
    font-weight: 650;
    cursor: pointer;
}
button:hover { background: #1b4938; }
.notice { padding: .65rem .8rem; border-radius: 8px; color: #8c3127; background: #fff1eb; }

.panel { min-height: 100svh; display: grid; grid-template-columns: 15rem minmax(0, 1fr); }
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.65rem;
    padding: 1.4rem 1rem;
    color: #e8f2ec;
    background: #142c26;
}
.sidebar nav { display: grid; gap: .25rem; }
.sidebar nav a { min-height: 44px; display: flex; align-items: center; padding: .55rem .75rem; border-radius: 8px; }
.sidebar nav a:hover, .sidebar nav [aria-current] { background: #2a5144; }
.sidebar nav [aria-current] { font-weight: 700; }
.logout { margin-top: auto; }
.logout button { background: transparent; border-color: #6f8e81; }
.logout button:hover { background: #2a5144; }
.content { padding: clamp(1.5rem, 5vw, 4.5rem); }
.content h1 { font-size: clamp(2rem, 5vw, 3rem); }
.empty-state, .integration-card {
    max-width: 48rem;
    margin: 0;
    padding: 1.2rem 1.35rem;
    background: white;
    border: 1px solid #dce5df;
    border-radius: 12px;
    color: #435c51;
}
.integration-card + .integration-card { margin-top: 1rem; }
.integration-card h2 { margin: 0; color: #1c312a; font-size: 1.25rem; }
.integration-card form { max-width: 28rem; }
.meta-accounts { list-style: none; padding: 0; margin: .75rem 0 0; }
.meta-accounts li { display: grid; gap: .2rem; padding: .65rem 0; overflow-wrap: anywhere; }
.meta-accounts li + li { border-top: 1px solid #dce5df; }
.meta-accounts span { font-size: .9rem; }
.copy-field { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .4rem; }
.copy-field input { flex: 1 1 18rem; min-width: 0; padding: .5rem; border: 1px solid #a4b5ab; border-radius: 8px; }
.table-scroll { max-width: 100%; overflow-x: auto; }
.history-table { width: 100%; border-collapse: collapse; text-align: left; }
.history-table caption { text-align: left; font-weight: 700; margin-bottom: .5rem; }
.history-table th, .history-table td { padding: .55rem .7rem; border-bottom: 1px solid #dce5df; }
.success { padding: .65rem .8rem; border-radius: 8px; color: #255c47; background: #e6f3e9; }
.report-filters { display: flex; gap: .65rem; flex-wrap: wrap; align-items: end; margin-bottom: 1rem; }
.report-filters label, .row-action label { display: grid; gap: .22rem; }
.report-filters input, .report-filters select, .inline-form select, .login-form select, .row-action input {
    min-height: 44px; max-width: 100%; border: 1px solid #a4b5ab; border-radius: 8px;
    padding: .45rem; background: white; color: inherit; font: inherit;
}
.inline-form { display: flex; align-items: end; gap: .4rem; flex-wrap: wrap; padding-top: .3rem; }
.report-table { max-width: none; margin: 1rem 0; }
.report-table td { vertical-align: top; }
.report-table small { display: block; font-size: .8rem; color: #435c51; }
.report-table details { min-width: 7rem; }
.report-table td:nth-child(n+3):nth-child(-n+10) { white-space: nowrap; }
.row-action { display: grid; gap: .4rem; padding-top: .5rem; }
.row-action input[type="number"] { width: 11rem; }
.pager { display: flex; gap: 1rem; margin: 1rem 0; }
.pager a { text-decoration: underline; }

@media (max-width: 720px) {
    .panel { display: block; }
    .sidebar { display: grid; grid-template-columns: 1fr auto; gap: .7rem; padding: .75rem 1rem .45rem; }
    .sidebar nav { grid-column: 1 / -1; grid-row: 2; display: flex; overflow-x: auto; white-space: nowrap; }
    .logout { grid-column: 2; grid-row: 1; margin: 0; }
}
