/* Modern Design System - PIM Odoo Sync */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    /* HSL Color System */
    --hue: 220;
    /* Primary Blue/Indigo */
    --sat: 90%;

    --primary: hsl(var(--hue), var(--sat), 56%);
    --primary-hover: hsl(var(--hue), var(--sat), 48%);
    --primary-light: hsl(var(--hue), var(--sat), 96%);

    --bg-body: #f8fafc;
    --bg-card: #ffffff;
    --bg-nav: #ffffff;

    --text-main: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;

    --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);

    --radius: 0.75rem;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

    --nav-height: 64px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-body: #0f172a;
        --bg-card: #1e293b;
        --bg-nav: #1e293b;
        --text-main: #f1f5f9;
        --text-muted: #94a3b8;
        --border: #334155;
        --primary-light: hsl(var(--hue), var(--sat), 15%);
    }
}

/* Reset & Base */
*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: var(--font-sans);
    background: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--primary-hover);
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 700;
    margin: 0 0 1rem 0;
    letter-spacing: -0.025em;
}

h4 {
    font-size: 1.5rem;
}

p {
    margin: 0 0 1rem 0;
}

.muted {
    color: var(--text-muted);
    font-size: 0.9em;
}

/* Layout */
.app-header {
    background: var(--bg-nav);
    border-bottom: 1px solid var(--border);
    height: var(--nav-height);
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(8px);
    background: color-mix(in srgb, var(--bg-nav), transparent 10%);
}

.app-header__inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo {
    width: 36px;
    height: 36px;
    background: var(--primary);
    color: white;
    border-radius: 10px;
    display: grid;
    place-items: center;
    font-weight: bold;
    box-shadow: 0 4px 6px -1px color-mix(in srgb, var(--primary), transparent 50%);
}

.brand-title {
    font-weight: 700;
    font-size: 1.1rem;
    line-height: 1.2;
}

.brand-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.topnav {
    display: flex;
    gap: 24px;
}

.nav-link {
    color: var(--text-muted);
    font-weight: 500;
    padding: 8px 0;
    position: relative;
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -20px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary);
    border-radius: 2px 2px 0 0;
}

.page {
    padding: 40px 20px;
    max-width: 1200px;
    margin: 0 auto;
    min-height: calc(100vh - var(--nav-height));
}

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.table-card {
    padding: 0;
    overflow: hidden;
}

.table-card>h4 {
    margin: 24px 24px 12px;
}

/* Buttons */
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: white;
    padding: 0 20px;
    height: 40px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}

.button:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.button-outline {
    background: transparent;
    color: var(--text-main);
    border-color: var(--border);
}

.button-outline:hover {
    background: var(--bg-body);
    border-color: var(--text-muted);
}

.button-clear {
    background: transparent;
    color: var(--text-muted);
    box-shadow: none;
}

.button-clear:hover {
    color: var(--text-main);
    background: var(--bg-body);
}

.inline-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Forms */
label {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 6px;
    color: var(--text-main);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="url"],
input[type="date"],
select,
textarea {
    width: 100%;
    display: block;
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 10px 12px;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--text-main);
    transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary), transparent 80%);
}

.form-grid {
    display: grid;
    gap: 24px;
}

.form-grid_2 {
    grid-template-columns: 1fr 1fr;
}

@media(max-width: 768px) {
    .form-grid_2 {
        grid-template-columns: 1fr;
    }
}

label.checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 400;
    cursor: pointer;
}

input[type="checkbox"] {
    width: 1.2em;
    height: 1.2em;
    accent-color: var(--primary);
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th {
    background: var(--bg-body);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 12px 24px;
    border-bottom: 1px solid var(--border);
}

td {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    font-size: 0.95rem;
}

tr:last-child td {
    border-bottom: none;
}

tbody tr:hover {
    background: color-mix(in srgb, var(--bg-body), transparent 50%);
}

/* Chips */
.chipwrap {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--primary-light);
    color: var(--primary);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

.chip button {
    background: none;
    border: none;
    color: currentColor;
    cursor: pointer;
    padding: 0;
    font-size: 1.1em;
    opacity: 0.6;
    display: grid;
    place-items: center;
}

.chip button:hover {
    opacity: 1;
}

/* Grid Utils */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

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

.row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.column {
    flex: 1;
}

/* Milligram-compat column widths */
.column-10 {
    flex: 0 0 10%;
    max-width: 10%;
}

.column-20 {
    flex: 0 0 20%;
    max-width: 20%;
}

.column-25 {
    flex: 0 0 25%;
    max-width: 25%;
}

.column-30 {
    flex: 0 0 30%;
    max-width: 30%;
}

.column-33 {
    flex: 0 0 33.3333%;
    max-width: 33.3333%;
}

.column-40 {
    flex: 0 0 40%;
    max-width: 40%;
}

.column-50 {
    flex: 0 0 50%;
    max-width: 50%;
}

.column-60 {
    flex: 0 0 60%;
    max-width: 60%;
}

.column-66 {
    flex: 0 0 66.6666%;
    max-width: 66.6666%;
}

.column-70 {
    flex: 0 0 70%;
    max-width: 70%;
}

.column-75 {
    flex: 0 0 75%;
    max-width: 75%;
}

.column-80 {
    flex: 0 0 80%;
    max-width: 80%;
}

.column-90 {
    flex: 0 0 90%;
    max-width: 90%;
}

textarea {
    resize: vertical;
}

/* Helpers */
.pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 99px;
    background: #dbeafe;
    color: #1e40af;
    font-size: 0.75rem;
    font-weight: 600;
}

details {
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

details summary {
    padding: 12px;
    background: var(--bg-body);
    cursor: pointer;
    font-weight: 600;
}

details[open] summary {
    border-bottom: 1px solid var(--border);
}

details textarea {
    border: none;
    border-radius: 0;
    resize: vertical;
    background: var(--bg-card);
}

code.block {
    display: block;
    background: #1e293b;
    color: #e2e8f0;
    padding: 16px;
    border-radius: 8px;
    overflow-x: auto;
    font-family: monospace;
    font-size: 0.9em;
}