@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=Oxygen:wght@400;700&display=swap');

:root {
    --gold: #bb7831;
    --blue: #32586b;
    --blue-soft: #3f6578;
    --blue-deep: #203f4f;
    --sand: #dabb95;
    --cream: #f7f2ea;
    --mist: #eef1f2;
    --white: #fff;
    --ink: #294b5b;
    --muted: #687a82;
    --line: rgba(50, 88, 107, .16);
    --danger: #9a3737;
    --success: #426f50;
    --shadow: 0 22px 60px rgba(32, 63, 79, .12);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 105px; }

body {
    margin: 0;
    background: linear-gradient(180deg, #f8f6f1 0%, #eef1f2 100%);
    color: var(--ink);
    font: 15px/1.6 Manrope, Inter, system-ui, sans-serif;
}

a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--gold); }
img { max-width: 100%; }
h1, h2, h3 { margin-top: 0; font-family: Oxygen, Manrope, sans-serif; letter-spacing: -1px; line-height: 1.08; }
h1 { margin-bottom: 8px; font-size: clamp(36px, 4vw, 58px); color: var(--blue); }
h2 { margin-bottom: 18px; font-size: 28px; color: var(--blue); }
h3 { margin-bottom: 12px; font-size: 21px; color: var(--blue); }
p { overflow-wrap: anywhere; }
code { padding: 3px 7px; border-radius: 5px; background: var(--mist); color: var(--blue-deep); }

.topbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    display: grid;
    min-height: 86px;
    padding: 12px clamp(20px, 3vw, 48px);
    background: var(--blue);
    box-shadow: 0 12px 32px rgba(32, 63, 79, .14);
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 30px;
}

.brand { display: flex; align-items: center; gap: 14px; color: var(--white); font-weight: 800; }
.brand:hover { color: var(--sand); }
.brand img { width: 148px; height: 52px; object-fit: contain; }
.brand span { padding-left: 14px; border-left: 1px solid rgba(255,255,255,.28); white-space: nowrap; }
.topbar nav { display: flex; min-width: 0; align-items: center; justify-content: center; gap: 4px; }
.topbar nav a { padding: 9px 10px; border-radius: 8px; color: rgba(255,255,255,.76); font-size: 13px; font-weight: 750; white-space: nowrap; }
.topbar nav a:hover { background: rgba(255,255,255,.09); color: var(--white); }
.topbar nav a.active { background: var(--sand); color: var(--blue-deep); }
.user { color: rgba(255,255,255,.8); font-size: 13px; white-space: nowrap; }
.user:hover { color: var(--white); }
.menu-toggle { display: none; }

.content { width: min(1440px, calc(100% - 44px)); min-height: calc(100vh - 150px); margin: 0 auto; padding: 52px 0 90px; }
.page-head { display: flex; margin-bottom: 34px; align-items: flex-end; justify-content: space-between; gap: 35px; }
.page-head p { max-width: 760px; margin: 0; color: var(--muted); font-size: 17px; }

.button {
    display: inline-flex;
    min-height: 46px;
    padding: 11px 18px;
    border: 1px solid transparent;
    border-radius: 8px;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font: 750 14px/1.15 Manrope, sans-serif;
    cursor: pointer;
    transition: .18s ease;
}
.button:hover { transform: translateY(-1px); color: var(--white); }
.button.primary { background: var(--gold); }
.button.primary:hover { background: #9f6127; }
.button.secondary { border-color: var(--blue); background: var(--blue); }
.button.secondary:hover { background: var(--blue-deep); }
.button.ghost { border-color: var(--line); background: var(--white); color: var(--blue); }
.button.ghost:hover { background: var(--mist); color: var(--blue-deep); }
.button.danger { background: var(--danger); }
.button.danger:hover { background: #792727; }

.panel {
    margin-bottom: 26px;
    padding: 30px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--white);
    box-shadow: var(--shadow);
}
.panel-head { display: flex; margin-bottom: 22px; align-items: center; justify-content: space-between; gap: 24px; }
.panel-head h2 { margin: 0; }

.card-grid { display: grid; margin-bottom: 28px; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.plan-card { position: relative; display: flex; min-height: 270px; padding: 26px; border-radius: 8px; background: var(--white); box-shadow: var(--shadow); flex-direction: column; }
.plan-card.featured { background: var(--sand); }
.plan-card h2 { margin: 13px 0 8px; font-size: 33px; }
.plan-card p { margin: 0 0 20px; color: var(--muted); }
.plan-card > strong { margin-top: auto; color: var(--blue); font-size: 25px; }
.plan-card > small { color: var(--muted); }
.card-actions { display: flex; margin-top: 20px; align-items: center; justify-content: space-between; gap: 12px; }

.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 15px 13px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--blue); font-size: 12px; letter-spacing: .04em; }
td strong, td small { display: block; }
td small { margin-top: 3px; color: var(--muted); }
tbody tr:hover { background: rgba(238,241,242,.55); }

.badge { display: inline-flex; width: fit-content; padding: 5px 9px; border-radius: 999px; background: var(--mist); color: var(--blue); font-size: 11px; font-weight: 800; white-space: nowrap; }
.badge.active, .badge.paid, .badge.sent { background: #dcebdc; color: var(--success); }
.badge.pending, .badge.open, .badge.draft { background: #fff0cc; color: #7a5600; }
.badge.cancelled, .badge.canceled, .badge.failed, .badge.expired { background: #f4dddd; color: var(--danger); }
.badge.suspended { background: #e5e0ed; color: #5f4777; }

.notice { margin-bottom: 24px; padding: 15px 18px; border-radius: 8px; font-weight: 650; }
.notice.success { background: #dcebdc; color: var(--success); }
.notice.error { background: #f4dddd; color: var(--danger); }
.notice.warning { background: #fff0cc; color: #7a5600; }

.stack { display: grid; gap: 18px; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
label { display: grid; align-content: start; color: var(--blue); font-weight: 750; gap: 7px; }
label small { color: var(--muted); font-weight: 500; }
input, select, textarea {
    width: 100%;
    min-height: 48px;
    padding: 11px 13px;
    border: 1px solid rgba(50,88,107,.25);
    border-radius: 8px;
    background: var(--white);
    color: var(--ink);
    font: inherit;
}
textarea { min-height: 125px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--gold); outline: 3px solid rgba(187,120,49,.15); }
.check-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px 22px; }
.check-grid.one { grid-template-columns: 1fr; }
.check-grid label { display: flex; align-items: flex-start; color: var(--ink); font-weight: 600; gap: 10px; }
.check-grid input { width: 19px; min-height: 19px; height: 19px; margin: 2px 0 0; accent-color: var(--gold); flex: 0 0 auto; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; }
.actions form { margin: 0; }
.editor { margin-top: 32px; }
.danger-zone { margin-top: 30px; padding: 24px; border: 1px solid rgba(154,55,55,.25); border-radius: 8px; background: #fff8f8; }
.danger-zone h3 { color: var(--danger); }
.search-row, .filter-row { display: flex; margin-bottom: 22px; align-items: end; gap: 10px; }
.search-row input { flex: 1; }
.filter-row label { min-width: 230px; }
.row-menu { min-width: 250px; }
.row-menu summary { color: var(--blue); cursor: pointer; font-weight: 750; }
.row-menu form { margin-top: 14px; padding: 18px; border-radius: 8px; background: var(--mist); }
.color-field { display: grid; grid-template-columns: 75px 1fr; gap: 9px; }
.color-field input[type="color"] { padding: 3px; }
.integration-actions { display: flex; margin-top: 25px; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.integration-actions form { display: flex; align-items: flex-end; gap: 10px; }
.settings-meta { display: grid; margin: 25px 0 0; padding-top: 22px; border-top: 1px solid var(--line); grid-template-columns: 180px 1fr; gap: 9px 18px; }
.settings-meta dt { color: var(--blue); font-weight: 750; }
.settings-meta dd { margin: 0; }

footer { padding: 24px; background: var(--blue-deep); color: rgba(255,255,255,.68); text-align: center; font-size: 13px; }

.auth-page { display: grid; min-height: 100vh; padding: 35px 18px; background: linear-gradient(130deg, var(--blue-deep), var(--blue-soft)); place-items: center; }
.auth-card { width: min(520px, 100%); padding: 38px; border-radius: 8px; background: var(--white); box-shadow: 0 28px 80px rgba(20,46,58,.32); }
.auth-card > img { display: block; width: 245px; margin: 0 0 25px; padding: 14px; border-radius: 8px; background: var(--blue); }
.auth-card h1 { font-size: 43px; }
.auth-card > p { color: var(--muted); }
.install-card { width: min(900px, 100%); }
.install-card section { padding: 24px; border-radius: 8px; background: var(--mist); }

@media (max-width: 1220px) {
    .topbar { grid-template-columns: auto auto 1fr; }
    .menu-toggle { display: inline-flex; width: 46px; height: 46px; border: 0; border-radius: 8px; background: var(--sand); color: var(--blue-deep); align-items: center; justify-content: center; font-size: 22px; cursor: pointer; }
    .topbar nav { position: absolute; top: 86px; right: 20px; left: 20px; display: none; padding: 20px; border-radius: 8px; background: var(--blue-deep); box-shadow: var(--shadow); flex-wrap: wrap; justify-content: flex-start; }
    .topbar nav.open { display: flex; }
    .user { justify-self: end; }
    .card-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 720px) {
    .topbar { padding: 10px 15px; grid-template-columns: 1fr auto; }
    .brand img { width: 125px; }
    .brand span, .user { display: none; }
    .content { width: calc(100% - 26px); padding: 35px 0 65px; }
    .page-head { align-items: stretch; flex-direction: column; }
    .card-grid, .fields, .check-grid { grid-template-columns: 1fr; }
    .panel, .auth-card { padding: 22px; }
    .search-row, .filter-row { align-items: stretch; flex-direction: column; }
    .search-row > *, .filter-row > * { width: 100%; }
    .integration-actions, .integration-actions form { align-items: stretch; flex-direction: column; }
    .settings-meta { grid-template-columns: 1fr; }
}
