/* KloudOne client area — matches the marketing site (direction C + A accents). */
:root {
    --navy: #0f2340; --navy-2: #17325a; --blue: #1f6feb; --blue-soft: #e8f0fe;
    --coral: #ff7a59; --coral-ink: #3a1206;
    --ink: #1b2533; --muted: #5b6878; --line: #e3e8ef; --bg: #f5f7fb; --card: #fff;
    --ok-bg: #e8f7ee; --ok: #0f6b3a; --warn-bg: #fff4e0; --warn: #8a5300;
    --err-bg: #fdecec; --err: #9b1c1c; --grey-bg: #eef1f5;
    --radius: 18px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.55 Inter, system-ui, -apple-system, sans-serif; }
a { color: var(--blue); }
h1, h2, h3 { font-family: Manrope, Inter, sans-serif; color: var(--navy); line-height: 1.2; margin: 0 0 12px; }
h1 { font-size: 1.55rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }
.muted { color: var(--muted); }
.skip { position: absolute; left: -999px; } .skip:focus { left: 16px; top: 8px; background: #fff; padding: 8px 12px; z-index: 10; }

/* Shell */
.topbar { background: var(--navy); color: #fff; display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; position: sticky; top: 0; z-index: 5; }
.brand { font-family: Manrope, sans-serif; font-weight: 800; font-size: 1.2rem; color: #fff; text-decoration: none; }
.brand span { color: var(--coral); }
.menu-btn { display: none; background: none; border: 1px solid rgba(255,255,255,.35); color: #fff; border-radius: 10px; padding: 6px 12px; font: inherit; cursor: pointer; }
.topbar .who { display: flex; align-items: center; gap: 12px; font-size: .9rem; color: #c9d4e5; }
.topbar form { margin: 0; }
.link-btn { background: none; border: 0; color: #fff; font: inherit; cursor: pointer; text-decoration: underline; padding: 0; }
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: calc(100vh - 56px); }
.sidebar { background: #fff; border-right: 1px solid var(--line); padding: 16px 12px; }
.sidebar a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; color: var(--ink); text-decoration: none; font-weight: 500; }
.sidebar a:hover { background: var(--grey-bg); }
.sidebar a[aria-current="page"] { background: var(--blue-soft); color: var(--blue); font-weight: 600; }
.sidebar .count { margin-left: auto; background: var(--coral); color: var(--coral-ink); border-radius: 999px; padding: 0 8px; font-size: .78rem; font-weight: 700; }
.sidebar .switch { margin-top: 16px; padding: 12px; border-top: 1px solid var(--line); }
.sidebar select { width: 100%; }
main.content { padding: 24px; max-width: 1080px; width: 100%; min-width: 0; } /* let wide tables scroll inside .table-wrap instead of widening the grid */
.grid > * { min-width: 0; }

@media (max-width: 860px) {
    .shell { grid-template-columns: 1fr; }
    .menu-btn { display: inline-block; }
    .sidebar { display: none; border-right: 0; border-bottom: 1px solid var(--line); }
    .sidebar.open { display: block; }
    .topbar .who .name { display: none; }
    main.content { padding: 16px; }
}

/* Building blocks */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.card > h2:first-child { margin-top: 0; }
.grid { display: grid; gap: 16px; }
.grid.stats { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin-bottom: 16px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; text-decoration: none; color: inherit; display: block; }
.stat .num { font-family: Manrope, sans-serif; font-size: 1.6rem; font-weight: 800; color: var(--navy); }
.stat .label { color: var(--muted); font-size: .9rem; }
.stat.alert { border-color: var(--coral); background: #fff7f4; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.page-head h1 { margin: 0; }

.btn { display: inline-flex; align-items: center; gap: 8px; border: 0; border-radius: 999px; padding: 10px 18px; font: 600 .95rem Inter, sans-serif; cursor: pointer; text-decoration: none; }
.btn.primary { background: var(--coral); color: var(--coral-ink); }
.btn.secondary { background: var(--blue-soft); color: var(--blue); }
.btn.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.btn:hover { filter: brightness(.96); }
.btn:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }

.table-wrap { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; }
table.list th { text-align: left; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); }
table.list td { padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.list tr:last-child td { border-bottom: 0; }
table.list .num { text-align: right; white-space: nowrap; }
table.list a.row-link { font-weight: 600; text-decoration: none; }
.empty { text-align: center; color: var(--muted); padding: 24px; }

.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.badge.active, .badge.paid, .badge.answered, .badge.sent { background: var(--ok-bg); color: var(--ok); }
.badge.unpaid, .badge.pending, .badge.customer_reply, .badge.open, .badge.in_progress, .badge.on_hold, .badge.pending_transfer, .badge.pending_registration, .badge.grace { background: var(--warn-bg); color: var(--warn); }
.badge.suspended, .badge.overdue, .badge.failed, .badge.expired, .badge.redemption { background: var(--err-bg); color: var(--err); }
.badge.terminated, .badge.cancelled, .badge.closed, .badge.refunded, .badge.completed, .badge.transferred_away { background: var(--grey-bg); color: var(--muted); }

dl.details { display: grid; grid-template-columns: max-content 1fr; gap: 8px 20px; margin: 0; }
dl.details dt { color: var(--muted); }
dl.details dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
@media (max-width: 520px) { dl.details { grid-template-columns: 1fr; gap: 2px; } dl.details dd { margin-bottom: 10px; } }

.notice { border-radius: 14px; padding: 12px 16px; margin-bottom: 16px; font-weight: 500; }
.notice.success { background: var(--ok-bg); color: var(--ok); }
.notice.info, .notice.warning { background: var(--warn-bg); color: var(--warn); }
.notice.error { background: var(--err-bg); color: var(--err); }

/* Forms */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.full { grid-column: 1 / -1; }
label { font-weight: 600; font-size: .9rem; }
input, select, textarea { font: inherit; padding: 10px 12px; border: 1px solid #cdd5e0; border-radius: 12px; background: #fff; color: var(--ink); width: 100%; }
textarea { min-height: 150px; resize: vertical; }
.error-text { color: var(--err); font-size: .85rem; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }

/* Ticket thread */
.thread { display: flex; flex-direction: column; gap: 12px; }
.msg { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; background: #fff; }
.msg.staff { background: var(--blue-soft); border-color: #cfe0fd; }
.msg .meta { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: .85rem; color: var(--muted); margin-bottom: 6px; }
.msg .body { white-space: pre-wrap; overflow-wrap: anywhere; }
.files { margin-top: 8px; font-size: .9rem; }

/* Auth pages */
.auth { min-height: 100vh; display: grid; grid-template-rows: auto 1fr; background: var(--bg); }
.auth-main { display: grid; place-items: center; padding: 24px 16px 40px; }
.auth-photo { position: relative; min-height: 190px; background-size: cover; background-position: center 30%; display: flex; align-items: flex-end; }
.auth-photo::before { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(15,35,64,.15) 0%, rgba(15,35,64,.85) 100%); }
.auth-photo-text { position: relative; color: #fff; padding: 20px 20px 18px; max-width: 520px; }
.auth-kicker { margin: 0 0 4px; font-size: .78rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; opacity: .85; }
.auth-quote { margin: 0; font-family: Manrope, Inter, sans-serif; font-weight: 800; font-size: 1.25rem; line-height: 1.3; }
.auth-photo ul { display: none; }
@media (min-width: 900px) {
    .auth { grid-template-rows: none; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
    .auth-photo { min-height: 100vh; position: sticky; top: 0; }
    .auth-photo-text { padding: 48px; }
    .auth-quote { font-size: 2rem; }
    .auth-photo ul { display: block; list-style: none; margin: 20px 0 0; padding: 0; font-size: .98rem; }
    .auth-photo li { padding-left: 26px; position: relative; margin-top: 10px; opacity: .95; }
    .auth-photo li::before { content: "✓"; position: absolute; left: 0; font-weight: 700; color: #f6a07a; }
}
.auth .card { width: 100%; max-width: 420px; padding: 28px; box-shadow: 0 20px 50px rgba(15,35,64,.18); }
.auth .brand { color: var(--navy); display: block; text-align: center; margin-bottom: 16px; font-size: 1.5rem; }
.auth .btn { width: 100%; justify-content: center; margin-top: 8px; }
.auth .links { display: flex; justify-content: space-between; margin-top: 14px; font-size: .9rem; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 500; } .check input { width: auto; }

iframe.email { width: 100%; min-height: 70vh; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.pagination { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }

/* Dashboard: photo welcome banner and "grow your business" cards */
.welcome { position: relative; display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; min-height: 170px; padding: 20px; margin-bottom: 16px; border-radius: var(--radius); overflow: hidden; background-size: cover; background-position: center 30%; color: #fff; }
.welcome::before { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(15,35,64,.92) 0%, rgba(15,35,64,.7) 45%, rgba(15,35,64,.2) 100%); }
.welcome > * { position: relative; }
.welcome h1 { color: #fff; margin: 0 0 4px; }
.welcome p { margin: 0; opacity: .85; }
@media (min-width: 900px) { .welcome { min-height: 200px; padding: 28px 32px; } }
.extras { margin-top: 8px; }
.grid.three { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 700px) { .grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.extra { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; text-decoration: none; color: var(--ink); transition: box-shadow .2s, transform .2s; }
.extra:hover { box-shadow: 0 12px 30px rgba(15,35,64,.12); transform: translateY(-2px); }
.extra img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; }
.extra-body { display: flex; flex-direction: column; gap: 6px; padding: 16px 18px 18px; flex: 1; }
.extra-body strong { font-family: Manrope, Inter, sans-serif; color: var(--navy); font-size: 1.05rem; }
.extra-body .muted { font-size: .92rem; flex: 1; }
.extra-link { color: var(--blue); font-weight: 600; font-size: .92rem; }
@media (prefers-reduced-motion: reduce) { .extra, .extra:hover { transition: none; transform: none; } }

/* Invoices: photo banners */
.welcome .crumbs { margin: 0 0 6px; font-size: .9rem; }
.welcome .crumbs a { color: #fff; }
.welcome .btn.ghost { background: rgba(255,255,255,.92); color: var(--navy); border-color: transparent; }
.welcome .badge { margin-right: 6px; }

/* Item thumbnails (cart, checkout, services) */
.line-item { display: flex; gap: 12px; align-items: flex-start; min-width: 170px; }
.line-item .thumb { flex: none; width: 72px; height: 54px; object-fit: cover; border-radius: 10px; }
.link-button { background: none; border: 0; padding: 0; margin-top: 6px; color: var(--blue); font: inherit; font-size: .88rem; text-decoration: underline; cursor: pointer; }
.line-item .thumb.small { width: 52px; height: 40px; border-radius: 8px; }
@media (max-width: 560px) { .line-item { flex-direction: column; gap: 6px; min-width: 0; } .line-item .thumb { width: 52px; height: 40px; } }
