@import url('https://fonts.googleapis.com/css2?family=Big+Shoulders+Display:wght@600;700;800&family=IBM+Plex+Sans:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* ink & paper */
    --paper: #eef1f7;
    --paper-white: #fbfcfe;
    --ink: #142b52;
    --ink-soft: #3d5478;
    --ink-faint: #7c8fac;
    --line: #d7deeb;

    /* process colors — used as signal, not decoration */
    --cyan: #0092c8;
    --magenta: #d1247e;
    --yellow: #e8b400;
    --key: #17181c;

    --danger: #c23b3b;

    --shadow-sm: 0 1px 2px rgba(23, 24, 28, 0.06);
    --shadow-md: 0 6px 16px rgba(23, 24, 28, 0.10);
    --shadow-lg: 0 14px 34px rgba(23, 24, 28, 0.16);

    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 14px;
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);

    --font-display: 'Big Shoulders Display', sans-serif;
    --font-body: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'IBM Plex Mono', monospace;
}

body {
    font-family: var(--font-body);
    background: var(--ink);
    background-image:
        radial-gradient(circle at 100% 0%, rgba(0, 146, 200, 0.10), transparent 45%),
        radial-gradient(circle at 0% 100%, rgba(209, 36, 126, 0.10), transparent 45%);
    min-height: 100vh;
    padding: 32px 20px 60px;
    color: var(--ink);
}

/* ===== registration mark — the signature motif ===== */
.reg-mark {
    width: 15px;
    height: 15px;
    border: 1.5px solid currentColor;
    border-radius: 50%;
    position: relative;
    flex-shrink: 0;
    opacity: 0.85;
}
.reg-mark::before,
.reg-mark::after {
    content: '';
    position: absolute;
    background: currentColor;
}
.reg-mark::before {
    top: -5px;
    bottom: -5px;
    left: 50%;
    width: 1.4px;
    transform: translateX(-50%);
}
.reg-mark::after {
    left: -5px;
    right: -5px;
    top: 50%;
    height: 1.4px;
    transform: translateY(-50%);
}

.container {
    max-width: 1440px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 460px 1fr;
    gap: 28px;
    align-items: start;
}

@media (max-width: 1024px) {
    .container {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    body {
        padding: 16px 14px 40px;
    }
}

/* ===== TOP MASTHEAD ===== */
.masthead {
    grid-column: 1 / -1;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    padding: 4px 4px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    margin-bottom: 4px;
    flex-wrap: wrap;
}

.masthead-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--paper-white);
}

.masthead-brand .reg-mark {
    color: var(--cyan);
    width: 22px;
    height: 22px;
}

.masthead h1 {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 30px;
    letter-spacing: 0.3px;
    line-height: 1;
    text-transform: uppercase;
}

.masthead-tag {
    font-family: var(--font-mono);
    font-size: 12px;
    color: rgba(255, 255, 255, 0.45);
    letter-spacing: 0.5px;
}

/* ===== FORM ===== */

.form-section {
    background: var(--paper-white);
    padding: 30px 30px 34px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    position: sticky;
    top: 24px;
    border-top: 4px solid var(--ink);
}

@media (max-width: 1024px) {
    .form-section {
        position: static;
    }
}

.header {
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.header .reg-mark {
    color: var(--magenta);
}

.header-text h2 {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 700;
    color: var(--ink);
    letter-spacing: 0.2px;
    text-transform: uppercase;
    line-height: 1.1;
}

.subtitle {
    font-size: 13px;
    color: var(--ink-faint);
    font-weight: 400;
    margin-top: 2px;
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    color: var(--ink-soft);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    font-family: var(--font-mono);
}

input[type="text"],
input[type="number"],
input[type="date"],
textarea,
select {
    width: 100%;
    padding: 10px 13px;
    border: 1.5px solid var(--line);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    background: var(--paper-white);
    color: var(--ink);
    transition: var(--transition);
}

textarea {
    resize: vertical;
    min-height: 64px;
    line-height: 1.5;
    font-family: var(--font-body);
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--cyan);
    box-shadow: 0 0 0 3px rgba(0, 146, 200, 0.14);
}

.input-group {
    display: flex;
    align-items: center;
    gap: 6px;
    border: 1.5px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 0 12px;
    background: var(--paper-white);
    transition: var(--transition);
}

.input-group:focus-within {
    border-color: var(--cyan);
    box-shadow: 0 0 0 3px rgba(0, 146, 200, 0.14);
}

.currency {
    font-weight: 700;
    color: var(--ink-faint);
    font-size: 13px;
    font-family: var(--font-mono);
}

.input-group input {
    flex: 1;
    border: none !important;
    padding: 10px 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}

.help-text {
    font-size: 11.5px;
    color: var(--ink-faint);
    margin-top: 6px;
    line-height: 1.4;
    font-family: var(--font-mono);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

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

.radio-group {
    display: flex;
    gap: 12px;
    margin-top: 8px;
}

.radio-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    color: var(--ink-soft);
    transition: var(--transition);
    padding: 9px 14px;
    border: 1.5px solid var(--line);
    border-radius: var(--radius-sm);
    flex: 1;
}

.radio-label .plate-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--ink-faint);
}

.radio-label:has(input:checked) {
    border-color: var(--ink);
    background: var(--ink);
    color: var(--paper-white);
}
.radio-label:has(input:checked) .plate-dot {
    background: var(--cyan);
}
.radio-label:nth-child(2):has(input:checked) .plate-dot {
    background: var(--magenta);
}

.radio-label input[type="radio"] {
    display: none;
}

.radio-label:hover {
    border-color: var(--ink-faint);
}

.btn-submit {
    width: 100%;
    padding: 13px 24px;
    background: var(--ink);
    color: var(--paper-white);
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    cursor: pointer;
    transition: var(--transition);
    margin-top: 4px;
}

.btn-submit:hover {
    background: #000;
}

.btn-submit:active {
    transform: translateY(1px);
}

.btn-cancel-edit {
    width: 100%;
    padding: 10px;
    background: transparent;
    color: var(--ink-faint);
    border: 1.5px dashed var(--line);
    border-radius: var(--radius-sm);
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 8px;
    display: none;
}
.btn-cancel-edit.visible {
    display: block;
}
.btn-cancel-edit:hover {
    border-color: var(--danger);
    color: var(--danger);
}

/* ===== CARD SECTION ===== */

.card-section {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

/* --- dashboard stat stubs (ticket / job-stub styling) --- */
.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
}

@media (max-width: 760px) {
    .stats-row {
        grid-template-columns: repeat(2, 1fr);
    }
}

.stat-stub {
    background: var(--paper-white);
    border-radius: var(--radius-md);
    padding: 16px 18px 14px;
    box-shadow: var(--shadow-md);
    position: relative;
    border-left: 3px solid var(--ink);
}
.stat-stub:nth-child(1) { border-left-color: var(--ink); }
.stat-stub:nth-child(2) { border-left-color: var(--cyan); }
.stat-stub:nth-child(3) { border-left-color: var(--magenta); }
.stat-stub:nth-child(4) { border-left-color: var(--yellow); }

.stat-label {
    font-family: var(--font-mono);
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--ink-faint);
    margin-bottom: 6px;
}

.stat-value {
    font-family: var(--font-display);
    font-size: 26px;
    font-weight: 700;
    color: var(--ink);
    line-height: 1;
}

.stat-sub {
    font-family: var(--font-mono);
    font-size: 10.5px;
    color: var(--ink-faint);
    margin-top: 4px;
}

/* --- toolbar: search / filter / export --- */
.toolbar {
    background: var(--paper-white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    padding: 14px 16px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.toolbar input[type="search"],
.toolbar select {
    padding: 9px 12px;
    font-size: 13px;
}

.toolbar-search {
    flex: 2;
    min-width: 160px;
}
.toolbar-select {
    flex: 1;
    min-width: 130px;
}

.toolbar-actions {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

.btn-tool {
    font-family: var(--font-mono);
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.3px;
    padding: 9px 13px;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--line);
    background: var(--paper-white);
    color: var(--ink-soft);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}
.btn-tool:hover {
    border-color: var(--ink);
    color: var(--ink);
}
.btn-tool.primary {
    background: var(--ink);
    color: var(--paper-white);
    border-color: var(--ink);
}
.btn-tool.primary:hover {
    background: #000;
}
#importFile {
    display: none;
}

.card-header-section {
    display: flex;
    align-items: center;
    gap: 14px;
}

.card-header-section h2 {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 700;
    color: var(--paper-white);
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.count-badge {
    background: rgba(255, 255, 255, 0.12);
    color: var(--paper-white);
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 600;
    padding: 3px 12px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.18);
}

#cardContainer {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.empty-state {
    background: var(--paper-white);
    padding: 60px 40px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
}

.empty-icon {
    margin-bottom: 16px;
    opacity: 0.5;
}
.empty-icon .reg-mark {
    width: 40px;
    height: 40px;
    color: var(--ink-faint);
}

.empty-state p {
    color: var(--ink-faint);
    font-size: 14px;
    line-height: 1.6;
}

/* ===== CLIENT GROUP ===== */

.client-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.client-group-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    background: rgba(255, 255, 255, 0.07);
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.client-group-header .reg-mark {
    color: var(--paper-white);
    width: 12px;
    height: 12px;
}

.client-group-name {
    font-family: var(--font-display);
    font-size: 17px;
    font-weight: 700;
    color: var(--paper-white);
    letter-spacing: 0.2px;
    text-transform: uppercase;
}

.client-group-count {
    font-family: var(--font-mono);
    background: rgba(255, 255, 255, 0.12);
    color: var(--paper-white);
    font-size: 11.5px;
    font-weight: 600;
    padding: 3px 11px;
    border-radius: 12px;
    margin-left: auto;
}

/* ===== SERVICE CARD ===== */

.service-card {
    background: var(--paper-white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    animation: slideUp 0.3s ease;
    margin-left: 22px;
    position: relative;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: translateY(0); }
}

.service-card-header {
    background: var(--ink);
    color: var(--paper-white);
    padding: 18px 22px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    position: relative;
}

.service-card-header .reg-mark {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 10px;
    height: 10px;
    color: rgba(255, 255, 255, 0.4);
}

.service-card-title {
    font-family: var(--font-display);
    font-size: 19px;
    font-weight: 700;
    margin-bottom: 3px;
    letter-spacing: 0.2px;
    padding-left: 14px;
}

.service-card-meta {
    font-family: var(--font-mono);
    font-size: 11.5px;
    opacity: 0.75;
    line-height: 1.5;
    padding-left: 14px;
}

.service-card-badge {
    font-family: var(--font-mono);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
}
.service-card-badge.frente { background: rgba(0, 146, 200, 0.25); border: 1px solid rgba(0, 146, 200, 0.4); }
.service-card-badge.frenteVerso { background: rgba(209, 36, 126, 0.25); border: 1px solid rgba(209, 36, 126, 0.4); }

.service-card-desc {
    padding: 14px 22px 14px;
    font-size: 13px;
    color: var(--ink-soft);
    line-height: 1.5;
    border-bottom: 1px solid var(--line);
    font-style: italic;
}

.service-card-body {
    padding: 18px 22px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

@media (max-width: 640px) {
    .service-card-body {
        grid-template-columns: repeat(2, 1fr);
    }
}

.service-info {
    display: flex;
    flex-direction: column;
}

.service-info-label {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--ink-faint);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.service-info-value {
    font-family: var(--font-mono);
    font-size: 15px;
    color: var(--ink);
    font-weight: 600;
}

.service-card-footer {
    padding: 13px 22px;
    background: var(--paper);
    border-top: 1px dashed var(--line);
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.fin-item {
    display: flex;
    flex-direction: column;
}

.fin-label {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--ink-faint);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.fin-value {
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 700;
    color: var(--ink);
    margin-top: 2px;
}

/* ===== ACTION BUTTONS ===== */

.btn-edit,
.btn-delete {
    border-radius: 50%;
    width: 30px;
    height: 30px;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    padding: 0;
    line-height: 1;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.12);
    color: var(--paper-white);
}

.btn-edit:hover {
    background: rgba(0, 146, 200, 0.5);
    transform: scale(1.08);
}

.btn-delete:hover {
    background: rgba(209, 36, 126, 0.5);
    transform: scale(1.08);
}

/* ===== SUMMARY CARD (tear-off stub) ===== */

.summary-card {
    background: var(--paper);
    border-radius: var(--radius-md);
    padding: 16px 22px;
    margin-left: 22px;
    border: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    position: relative;
}

.summary-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background-image: repeating-linear-gradient(90deg, var(--ink-faint) 0 6px, transparent 6px 12px);
    opacity: 0.4;
}

.summary-card-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-mono);
    font-size: 11.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--ink-soft);
}

.summary-card-label .reg-mark {
    width: 11px;
    height: 11px;
    color: var(--magenta);
}

.summary-card-detail {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--ink-faint);
    display: block;
    margin-top: 3px;
}

.summary-card-value {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 700;
    color: var(--ink);
    text-align: right;
}

.no-results {
    background: var(--paper-white);
    padding: 40px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    text-align: center;
    color: var(--ink-faint);
    font-size: 14px;
}

@media print {
    .form-section, .toolbar, .btn-edit, .btn-delete, .masthead { display: none !important; }
    body { background: white; padding: 0; }
    .container { grid-template-columns: 1fr; }
}
