:root {
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #f5f7fb;
    color: #172033;
}

* { box-sizing: border-box; }
body { margin: 0; background: #f5f7fb; }
a { color: inherit; text-decoration: none; }

.app-shell { min-height: 100vh; display: flex; }
.sidebar {
    width: 240px;
    background: #111827;
    color: #fff;
    padding: 24px 18px;
}
.brand { font-size: 18px; font-weight: 700; margin-bottom: 30px; }
.sidebar nav { display: grid; gap: 7px; }
.sidebar nav a {
    padding: 11px 12px;
    border-radius: 8px;
    color: #cbd5e1;
}
.sidebar nav a:hover,
.sidebar nav a.active { background: #1f2937; color: #fff; }

.main { flex: 1; padding: 32px; min-width: 0; }
.page-heading {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: center;
    margin-bottom: 26px;
}
h1 { margin: 0 0 6px; font-size: 28px; }
h2 { margin: 0; font-size: 18px; }
p { margin: 0; color: #64748b; }

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 16px;
    border-radius: 8px;
    font-weight: 600;
}
.button.primary { background: #2563eb; color: #fff; }

.cards {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 20px;
}
.card span { display: block; color: #64748b; font-size: 13px; margin-bottom: 10px; }
.card strong { font-size: 26px; }
.card.danger strong { color: #b91c1c; }

.panel {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
}
.panel-heading {
    padding: 18px 20px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.panel-heading a { color: #2563eb; font-weight: 600; font-size: 14px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 13px 20px; text-align: left; border-bottom: 1px solid #eef2f7; font-size: 14px; }
th { color: #64748b; background: #fafafa; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
.empty { text-align: center; padding: 32px; color: #94a3b8; }

.status {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 999px;
    background: #eef2ff;
    font-size: 12px;
    text-transform: capitalize;
}
.status-overdue,
.status-payment_pending { background: #fee2e2; color: #991b1b; }
.status-expiring_soon,
.status-cancellation_scheduled { background: #fef3c7; color: #92400e; }
.status-active { background: #dcfce7; color: #166534; }

@media (max-width: 980px) {
    .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .sidebar { width: 200px; }
}


.muted { color:#94a3b8; font-size:12px; }
.text-link { color:#2563eb; font-weight:600; }
.notice { margin:0 0 18px; padding:12px 14px; border-radius:8px; border:1px solid transparent; }
.notice.success { background:#ecfdf5; color:#166534; border-color:#bbf7d0; }
.notice.error { background:#fef2f2; color:#991b1b; border-color:#fecaca; }

.form-panel { padding:20px; }
.form-panel h2 { margin-bottom:18px; }
.form-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; }
.form-grid .full { grid-column:1 / -1; }
label { display:grid; gap:7px; font-size:13px; font-weight:600; color:#334155; }
input, select, textarea {
    width:100%;
    border:1px solid #cbd5e1;
    border-radius:8px;
    padding:10px 11px;
    font:inherit;
    background:#fff;
    color:#172033;
}
textarea { resize:vertical; }
.inline-fields { display:grid; grid-template-columns:1fr 90px; gap:8px; }
.check-group { display:flex; align-items:center; gap:20px; }
.check { display:flex; grid-template-columns:auto 1fr; align-items:center; gap:8px; font-weight:500; }
.check input { width:auto; }
.form-actions { margin-top:20px; display:flex; justify-content:flex-end; }
.button { border:1px solid #d1d5db; background:#fff; cursor:pointer; }
.button.small { min-height:32px; padding:0 10px; font-size:12px; }
.action-row { display:flex; gap:7px; flex-wrap:wrap; }
.action-row form { margin:0; }
.two-column { display:grid; grid-template-columns:340px minmax(0,1fr); gap:18px; }

@media (max-width: 980px) {
    .form-grid { grid-template-columns:1fr; }
    .form-grid .full { grid-column:auto; }
    .two-column { grid-template-columns:1fr; }
}


.status-expired,
.status-cancelled,
.status-paused { background:#e5e7eb; color:#475569; }
.status-cancellation_scheduled { background:#fef3c7; color:#92400e; }

.filter-bar {
    display:grid;
    grid-template-columns:minmax(260px,2fr) repeat(3,minmax(150px,1fr)) auto auto;
    gap:10px;
    margin-bottom:18px;
}
.tabs { display:flex; gap:8px; flex-wrap:wrap; margin-bottom:18px; }
.tabs a { padding:9px 12px; border:1px solid #dbe2ea; background:#fff; border-radius:8px; font-size:13px; font-weight:600; color:#475569; }
.tabs a.active { background:#2563eb; border-color:#2563eb; color:#fff; }
.detail-cards .card strong.compact { font-size:18px; }
.two-column-wide { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:18px; }
.section-gap { margin-top:18px; }
.detail-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; margin-top:18px; }
.detail-grid div { display:grid; gap:5px; }
.detail-grid span { color:#64748b; font-size:12px; }
.detail-grid strong { font-size:14px; }
.notes-box { margin-top:20px; padding:14px; background:#f8fafc; border:1px solid #e2e8f0; border-radius:8px; line-height:1.6; }
.field-help { font-size:11px; color:#94a3b8; font-weight:400; }
.master-check { margin-top:16px; }
.attention-panel { border-color:#fecaca; margin-bottom:18px; }

@media (max-width:1200px) {
    .filter-bar { grid-template-columns:1fr 1fr; }
}
@media (max-width:980px) {
    .two-column-wide { grid-template-columns:1fr; }
    .detail-grid { grid-template-columns:1fr; }
}
