/* ==========================================================================
   MyDataTheme — design tokens, reset, base layout primitives.
   Component styles live in css/components/*.css, page styles in css/pages/*.css.

   MyData is a software-licensing storefront plus a post-sale license workspace,
   not a content site: the surface language is card + panel rather than editorial.

   Visual system (Product Owner reference, 2026-08-27): white ground, one strong
   blue/navy brand pair, bold navy headings, clearly bordered cards, small radii,
   generous section spacing and almost no shadow. Borders — not elevation — are
   what separate surfaces here, so a card always keeps a visible border.
   ========================================================================== */

:root {
    /* Brand — a single blue/navy pair. No second competing hue. */
    --md-primary: #1f69b3;
    --md-primary-hover: #17558f;
    --md-primary-dark: #124a7a;
    --md-primary-soft: #edf4fb;
    --md-primary-border: #b9d3eb;

    /* Informational accent stays inside the same blue family. */
    --md-accent: #0b5c93;
    --md-accent-soft: #e7f1f9;

    --md-success: #14683f;
    --md-success-soft: #e1f3e9;
    --md-warning: #8f5509;
    --md-warning-soft: #fbf0dc;
    --md-danger: #a82121;
    --md-danger-soft: #fbe7e7;
    --md-neutral-soft: #eaeef3;

    --md-bg: #ffffff;
    --md-surface: #ffffff;
    --md-surface-alt: #f4f7fa;
    --md-ink: #0e2c48;
    --md-ink-soft: #3b4e61;
    --md-muted: #5f6e7d;
    --md-border: #dce3ea;
    --md-border-strong: #bcc7d2;

    /* Small radii throughout: 5px is the norm, 7px the ceiling for containers. */
    --md-radius-sm: 3px;
    --md-radius-md: 5px;
    --md-radius-lg: 7px;

    /* Shadows are a hover affordance only, never the thing that defines an edge. */
    --md-shadow-sm: 0 1px 2px rgba(14, 44, 72, .05);
    --md-shadow-md: 0 2px 8px rgba(14, 44, 72, .08);

    --md-max-width: 1200px;
    --md-max-width-narrow: 760px;
    --md-header-offset: 72px;
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
    margin: 0;
    min-height: 100vh;
    background: var(--md-bg);
    color: var(--md-ink);
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.6;
    overflow-x: hidden;
}

img, svg { max-width: 100%; display: block; }

a { color: var(--md-primary-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { line-height: 1.22; margin: 0 0 8px; color: var(--md-ink); font-weight: 700; }
h1 { font-size: 36px; font-weight: 800; letter-spacing: -.022em; }
h2 { font-size: 26px; font-weight: 800; letter-spacing: -.018em; }
h3 { font-size: 18px; }

p { margin: 0 0 8px; color: var(--md-ink-soft); }

button, input, select, textarea { font: inherit; color: inherit; }

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
    }
}

/* -- Accessibility ------------------------------------------------------- */

.md-visually-hidden {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.md-skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 100;
    background: var(--md-primary-dark);
    color: #fff;
    padding: 10px 16px;
    border-radius: 0 0 var(--md-radius-sm) 0;
}
.md-skip-link:focus { left: 0; }

:focus-visible {
    outline: 2px solid var(--md-primary);
    outline-offset: 2px;
    border-radius: 2px;
}

/* -- Layout primitives --------------------------------------------------- */

.md-main { min-height: 60vh; }

.md-container {
    width: 100%;
    max-width: var(--md-max-width);
    margin: 0 auto;
    padding: 0 20px;
}
.md-container--narrow { max-width: var(--md-max-width-narrow); }

.md-section { padding: 48px 0; }
.md-section--tight { padding: 32px 0; }
.md-section--alt { background: var(--md-surface-alt); border-block: 1px solid var(--md-border); }
/* Two adjacent alt bands must not stack their borders into a 2px seam. */
.md-section--alt + .md-section--alt { border-top: 0; }

.md-section__head { margin-bottom: 24px; }
.md-section__eyebrow {
    display: block;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--md-primary);
    margin-bottom: 8px;
}
/* Short blue rule under a section title — the section hierarchy marker. */
.md-section__title { margin: 0 0 8px; padding-bottom: 12px; position: relative; }
.md-section__title::after {
    content: "";
    position: absolute;
    left: 0; bottom: 0;
    width: 44px; height: 3px;
    background: var(--md-primary);
}
.md-section__desc { margin: 0; color: var(--md-muted); max-width: 68ch; }
.md-section__more { display: inline-block; margin-top: 16px; font-weight: 600; }

/* Page head for a working page (title + lead + one page-level action). Lives in
   the base sheet because catalog, assistant, support and the five account routes
   all use it, and those routes load different page bundles. */
.md-account-head {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--md-border);
}
.md-account-head h1 { margin: 0 0 6px; font-size: 28px; }
.md-account-head p { margin: 0; color: var(--md-muted); max-width: 64ch; }

.md-grid { display: grid; gap: 16px; }
.md-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.md-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.md-grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

@media (max-width: 1024px) {
    .md-grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .md-grid--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
    .md-grid--2, .md-grid--3, .md-grid--4 { grid-template-columns: minmax(0, 1fr); }
    h1 { font-size: 27px; }
    h2 { font-size: 21px; }
    .md-section { padding: 32px 0; }
}

/* -- Surfaces ------------------------------------------------------------ */

.md-panel {
    background: var(--md-surface);
    border: 1px solid var(--md-border);
    border-radius: var(--md-radius-lg);
    padding: 24px;
}
.md-panel + .md-panel { margin-top: 24px; }
.md-panel__head {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--md-border);
}
.md-panel__title { margin: 0; font-size: 17px; font-weight: 700; letter-spacing: 0; }

/* -- Buttons ------------------------------------------------------------- */

.md-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--md-radius-md);
    border: 1px solid transparent;
    font-weight: 600;
    font-size: 15px;
    line-height: 1.4;
    cursor: pointer;
    text-decoration: none;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.md-btn:hover { text-decoration: none; }

.md-btn--primary { background: var(--md-primary); border-color: var(--md-primary); color: #fff; }
.md-btn--primary:hover { background: var(--md-primary-hover); border-color: var(--md-primary-hover); color: #fff; }
.md-btn--primary:active { background: var(--md-primary-dark); border-color: var(--md-primary-dark); }

.md-btn--secondary {
    background: var(--md-surface);
    color: var(--md-primary-dark);
    border-color: var(--md-border-strong);
}
.md-btn--secondary:hover { background: var(--md-primary-soft); border-color: var(--md-primary); color: var(--md-primary-dark); }
.md-btn--secondary:active { background: var(--md-primary-border); }

.md-btn--ghost { background: transparent; color: var(--md-primary-dark); padding-inline: 8px; }
.md-btn--ghost:hover { background: var(--md-primary-soft); }

.md-btn--danger { background: var(--md-surface); color: var(--md-danger); border-color: var(--md-danger); }
.md-btn--danger:hover { background: var(--md-danger-soft); }

.md-btn--block { width: 100%; }
.md-btn--lg { padding: 13px 26px; font-size: 16px; }
.md-btn[disabled], .md-btn[aria-disabled="true"] { opacity: .55; pointer-events: none; }

.md-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.md-actions--split { justify-content: space-between; }
/* AGENTS 13.5 - a destructive control never sits flush against the primary one. */
.md-actions__danger { margin-left: auto; padding-left: 24px; }
@media (max-width: 640px) {
    .md-actions { flex-direction: column; align-items: stretch; }
    .md-actions__danger { margin-left: 0; padding-left: 0; }
    .md-actions .md-btn { width: 100%; }
}

/* -- Status badges --------------------------------------------------------
   Square-cornered, not pills: a status is a label on a data row, and the pill
   shape was the strongest generic-SaaS tell in the previous palette. */

.md-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 9px;
    border-radius: var(--md-radius-sm);
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.5;
    white-space: nowrap;
}
.md-badge::before {
    content: "";
    width: 6px; height: 6px;
    border-radius: 50%;
    background: currentColor;
}
.md-badge--success { background: var(--md-success-soft); color: var(--md-success); }
.md-badge--info    { background: var(--md-accent-soft); color: var(--md-accent); }
.md-badge--warning { background: var(--md-warning-soft); color: var(--md-warning); }
.md-badge--danger  { background: var(--md-danger-soft); color: var(--md-danger); }
.md-badge--neutral { background: var(--md-neutral-soft); color: var(--md-ink-soft); }
.md-badge--plain::before { display: none; }

/* -- Forms --------------------------------------------------------------- */

.md-field { margin-bottom: 12px; }
.md-field__label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 14px;
    color: var(--md-ink);
}
.md-field__req { color: var(--md-danger); margin-left: 2px; }
.md-field__control {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--md-border-strong);
    border-radius: var(--md-radius-md);
    background: var(--md-surface);
}
.md-field__control:focus { border-color: var(--md-primary); }
/* AGENTS 13.3 - short data never stretches full width. */
.md-field__control--short { max-width: 220px; }
.md-field__help { margin: 8px 0 0; font-size: 13px; color: var(--md-muted); }
.md-field__error { margin: 8px 0 0; font-size: 13px; color: var(--md-danger); font-weight: 500; }
.md-fieldset { border: 0; margin: 0 0 24px; padding: 0; }
.md-fieldset__legend { font-size: 15px; font-weight: 700; padding: 0; margin-bottom: 16px; }

/* -- Inline feedback (rendered only for a real, active state - AGENTS 12.4) */

.md-alert {
    display: flex;
    gap: 12px;
    padding: 14px 16px;
    border-radius: var(--md-radius-md);
    border: 1px solid;
    border-left-width: 4px;
    margin-bottom: 24px;
    font-size: 14.5px;
}
.md-alert--info { background: var(--md-accent-soft); border-color: #b9d3eb; color: #0b4b78; }
.md-alert--success { background: var(--md-success-soft); border-color: #a9d8bf; color: var(--md-success); }
.md-alert--warning { background: var(--md-warning-soft); border-color: #e5c68a; color: var(--md-warning); }
.md-alert--danger { background: var(--md-danger-soft); border-color: #edb4b4; color: var(--md-danger); }

/* -- Breadcrumb ---------------------------------------------------------- */

.md-breadcrumb {
    padding: 12px 0;
    font-size: 13.5px;
    color: var(--md-muted);
    background: var(--md-surface-alt);
    border-bottom: 1px solid var(--md-border);
}
.md-breadcrumb ol { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; }
.md-breadcrumb li::after { content: "/"; margin-left: 8px; color: var(--md-border-strong); }
.md-breadcrumb li:last-child::after { content: none; }

/* -- Label / value pairs on detail pages --------------------------------- */

.md-datalist { display: grid; gap: 12px; margin: 0; }
.md-datalist--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.md-datalist__row { margin: 0; }
.md-datalist__label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--md-muted);
    margin-bottom: 4px;
}
.md-datalist__value { margin: 0; font-weight: 600; color: var(--md-ink); }
@media (max-width: 640px) { .md-datalist--2 { grid-template-columns: minmax(0, 1fr); } }

/* -- Tables -------------------------------------------------------------- */

.md-table-wrap { overflow-x: auto; }
.md-table { width: 100%; border-collapse: collapse; font-size: 14.5px; min-width: 560px; }
.md-table th, .md-table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--md-border); }
.md-table th {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--md-ink-soft);
    background: var(--md-surface-alt);
    border-bottom: 1px solid var(--md-border-strong);
}
.md-table tr:last-child td { border-bottom: none; }
