*, *::before, *::after { box-sizing: border-box; }

:root {
    --ink:      #1B1D2A;
    --ink-mid:  #5C5F72;
    --line:     #DEDFE8;
    --bg:       #F3F3F8;
    --white:    #fff;
    --accent:   #4F5AE0;
    --accent-dk:#3A44C4;
    --red:      #C0392B;
    --red-lt:   #FCEBEB;
    --green:    #1D9E75;
    --amber:    #B8860B;
    --radius:   10px;
    --shadow:   0 1px 3px rgba(0,0,0,.06), 0 4px 12px rgba(0,0,0,.05);
}

body {
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, Arial, sans-serif;
    background: var(--bg);
    color: var(--ink);
    font-size: 14px;
}

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

.topbar {
    background: var(--white);
    border-bottom: 1px solid var(--line);
    padding: 14px 24px;
    display: flex; justify-content: space-between; align-items: center;
}
.topbar .brand { font-weight: 700; font-size: 15px; }
.topbar .brand span { color: var(--accent-dk); }
.topbar .who { font-size: 12px; color: var(--ink-mid); }
.topbar .who a { margin-left: 10px; }

.page-wrap { max-width: 1100px; margin: 0 auto; padding: 24px 16px; }

.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; margin-bottom: 16px; }
.card-head { padding: 12px 16px; background: var(--bg); border-bottom: 1px solid var(--line); font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-mid); display: flex; justify-content: space-between; align-items: center; }
.card-body { padding: 16px; }

.btn { display: inline-flex; align-items: center; gap: 6px; font-family: inherit; font-size: 13px; font-weight: 600; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--white); color: var(--ink); cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--bg); }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent-dk); }
.btn-primary:hover { background: var(--accent-dk); }
.btn-danger { color: var(--red); border-color: #f0b3ab; }
.btn-danger:hover { background: var(--red-lt); }
.btn-sm { padding: 5px 10px; font-size: 12px; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-mid); margin-bottom: 4px; }
.field input, .field select, .field textarea { width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; font-family: inherit; }
.field-row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

table.themed { width: 100%; border-collapse: collapse; font-size: 13px; }
table.themed th, table.themed td { border-bottom: 1px solid var(--line); padding: 10px; text-align: left; }
table.themed th { background: var(--bg); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-mid); }

.badge { display: inline-block; font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 99px; color: #fff; }
.badge-pending { background: var(--ink-mid); }
.badge-trial { background: var(--amber); }
.badge-active { background: var(--green); }
.badge-past_due { background: #E0562F; }
.badge-canceled { background: var(--red); }

.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 999; align-items: center; justify-content: center; }
.modal-overlay.open { display: flex; }
.modal-box { background: var(--white); border-radius: var(--radius); padding: 20px; width: 100%; max-width: 420px; margin: 16px; }
.modal-box h3 { margin: 0 0 12px; font-size: 15px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }

.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-box { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 28px; width: 100%; max-width: 340px; }
.login-box h1 { font-size: 17px; margin: 0 0 16px; }
.login-error { background: var(--red-lt); color: var(--red); font-size: 12px; padding: 8px 10px; border-radius: 6px; margin-bottom: 12px; }

.status-note { font-size: 12px; color: var(--ink-mid); margin-top: 8px; }
