/* ============================================================
   Invoice Sender — minimalist chrome theme
   ============================================================ */
:root {
    --text: #1f2324;
    --muted: #505759;
    --accent: #3d4446;
    --error: #b04a2a;
    --radius: 14px;
    --font: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    --well: #b8bcc0;
    --page-bg: #0e1011;
    --chrome-edge: #8f9294;
    --chrome-mid: #d4d6d8;
    --chrome-hi: #f7f8f8;
    --ok: #2e6b3e;
}

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

body {
    font-family: var(--font);
    color: var(--text);
    min-height: 100vh;
    background: var(--page-bg);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 40px 16px;
}

.page { width: 100%; display: flex; justify-content: center; }

/* ---- Metal panel ---- */
.panel {
    position: relative;
    width: 100%;
    max-width: 460px;
    padding: 48px 40px 40px;
    border-radius: var(--radius);
    background: linear-gradient(90deg, var(--chrome-edge) 0%, var(--chrome-mid) 25%, var(--chrome-hi) 50%, var(--chrome-mid) 75%, var(--chrome-edge) 100%);
    border: 1.5px solid rgba(255,255,255,.3);
    box-shadow: 0 8px 32px rgba(0,0,0,.45);
    overflow: hidden;
}

/* ---- Typography ---- */
.eyebrow {
    font-size: .65rem;
    letter-spacing: .22em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 8px;
}

h1 {
    font-size: 1.45rem;
    font-weight: 600;
    margin-bottom: 16px;
    letter-spacing: .01em;
}

p { line-height: 1.6; }
.body-text { color: var(--muted); font-size: .85rem; }

/* ---- Status light ---- */
.status-light {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: .7rem;
    letter-spacing: .14em;
    color: var(--muted);
    margin-bottom: 24px;
}
.status-light::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--text);
    box-shadow: 0 0 6px rgba(255,255,255,.4);
}

/* ---- Buttons ---- */
.btn {
    display: inline-block;
    font-family: var(--font);
    font-size: .8rem;
    letter-spacing: .06em;
    padding: 10px 22px;
    border: 1px solid rgba(0,0,0,.15);
    border-radius: 8px;
    background: linear-gradient(180deg, #e6e8ea 0%, #c4c8cc 100%);
    color: var(--text);
    text-decoration: none;
    cursor: pointer;
    box-shadow:
        0 1px 0 rgba(255,255,255,.5) inset,
        0 -1px 0 rgba(0,0,0,.12) inset,
        0 3px 6px rgba(0,0,0,.18);
    transition: box-shadow .1s;
    text-align: center;
}
.btn:active {
    box-shadow:
        0 2px 6px rgba(0,0,0,.2) inset,
        0 1px 0 rgba(255,255,255,.3);
    transform: translateY(1px);
}

/* ---- Shared glass style: primary buttons + code boxes ---- */
.btn-primary, .code-boxes .code-box {
    background:
        linear-gradient(180deg, rgba(255,255,255,.35), rgba(255,255,255,.10)) padding-box,
        conic-gradient(from var(--glow-angle),
            transparent 0deg,
            rgba(255,255,255,.6) 45deg, rgba(255,255,255,.15) 60deg,
            transparent 90deg,
            transparent 180deg,
            rgba(255,255,255,.6) 225deg, rgba(255,255,255,.15) 240deg,
            transparent 270deg) border-box;
    border: 1px solid transparent;
    position: relative;
    isolation: isolate;
    animation: glow-spin 8s linear infinite;
    animation-play-state: paused;
}
.btn-primary::before, .code-boxes .code-box::before {
    content: "";
    position: absolute;
    inset: -2px;
    border-radius: inherit;
    background: conic-gradient(from var(--glow-angle),
        transparent 0deg,
        rgba(255,255,255,.6) 45deg, rgba(255,255,255,.15) 60deg,
        transparent 90deg,
        transparent 180deg,
        rgba(255,255,255,.6) 225deg, rgba(255,255,255,.15) 240deg,
        transparent 270deg);
    filter: blur(6px);
    opacity: .6;
    z-index: -1;
}
.btn-primary:hover, .btn-primary:focus-visible,
.code-boxes:focus-within .code-box {
    animation-play-state: running;
}
.btn-primary:hover::before, .btn-primary:focus-visible::before,
.code-boxes .code-box.active::before {
    opacity: 1;
}

.btn-primary {
    color: var(--text);
}

/* ---- Links ---- */
.link {
    color: var(--muted);
    font-size: .75rem;
    text-decoration: underline;
    text-underline-offset: 3px;
}
.link:hover { color: var(--text); }

/* ---- Responsive ---- */
@media (max-width: 520px) {
    .panel { padding: 36px 22px 30px; }
    h1 { font-size: 1.2rem; }
}

/* ---- QR page ---- */
.qr-plate {
    position: relative;
    background: #f4f6f4;
    padding: 16px;
    border-radius: 8px;
    margin: 20px 0;
    box-shadow: inset 0 1px 3px rgba(0,0,0,.15), 0 1px 0 rgba(255,255,255,.5);
}
.qr-plate svg {
    display: block;
    width: 100%;
    height: auto;
}
.qr-logo {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 22%;
    aspect-ratio: 1;
    background: #f4f6f4;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
}
.qr-logo svg {
    animation: needle-drift 4s ease-in-out infinite;
}

@keyframes needle-drift {
    0%, 100% { transform: rotate(-18deg); }
    50% { transform: rotate(18deg); }
}

@media (prefers-reduced-motion: reduce) {
    .qr-logo svg { animation: none; }
}

/* ---- Steps list ---- */
.steps {
    list-style: none;
    counter-reset: step;
    margin: 20px 0;
    padding: 0;
}
.steps li {
    counter-increment: step;
    position: relative;
    padding-left: 28px;
    margin-bottom: 8px;
    font-size: .8rem;
    color: var(--muted);
}
.steps li::before {
    content: counter(step);
    position: absolute;
    left: 0;
    top: 0;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgba(0,0,0,.06);
    font-size: .65rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
}

/* ---- Code display (phone) ---- */
.code-display {
    font-size: 2.2rem;
    letter-spacing: .25em;
    text-align: center;
    padding: 18px 12px;
    margin: 20px 0;
    background: var(--well);
    border-radius: 8px;
    box-shadow: inset 0 2px 6px rgba(0,0,0,.15);
    color: var(--text);
}

/* ---- Inputs ---- */
input[type="text"] {
    width: 100%;
    font-family: var(--font);
    font-size: 1rem;
    padding: 12px 14px;
    border: 1px solid rgba(0,0,0,.15);
    border-radius: 8px;
    background: var(--well);
    color: var(--text);
    box-shadow: inset 0 2px 4px rgba(0,0,0,.12);
    outline: none;
    margin-bottom: 12px;
}
input[type="text"]:focus {
    border-color: rgba(255,255,255,.55);
    box-shadow: inset 0 2px 4px rgba(0,0,0,.12), 0 0 0 2px rgba(255,255,255,.25);
}

/* ---- Error text ---- */
.error-text {
    color: var(--error);
    font-size: .8rem;
    margin-bottom: 12px;
}

/* ---- Form spacing ---- */
form .btn {
    width: 100%;
    margin-bottom: 16px;
}

/* ---- Code input as 6 boxes (progressive enhancement) ---- */
.code-boxes {
    position: relative;
    margin-bottom: 12px;
    text-align: center;
}
.code-boxes .code-box {
    display: none;
    width: 44px;
    height: 52px;
    line-height: 52px;
    text-align: center;
    font-family: var(--font);
    font-size: 1.3rem;
    border-radius: 12px;
    margin-right: 6px;
    vertical-align: top;
}
.code-boxes .code-box:last-child {
    margin-right: 0;
}
.code-boxes .code-box.active {
    border-color: rgba(255,255,255,.55);
}
/* Without JS: normal visible input */
.code-boxes .code-input {
    width: 100%;
    font-family: var(--font);
    font-size: 1rem;
    padding: 12px 14px;
    border: 1px solid rgba(0,0,0,.15);
    border-radius: 8px;
    background: var(--well);
    color: var(--text);
    box-shadow: inset 0 2px 4px rgba(0,0,0,.12);
    outline: none;
}
.code-boxes .code-input:focus {
    border-color: rgba(255,255,255,.55);
    box-shadow: inset 0 2px 4px rgba(0,0,0,.12), 0 0 0 2px rgba(255,255,255,.25);
}
/* With JS: overlay transparent input on boxes */
.code-boxes.js .code-box {
    display: inline-block;
}
.code-boxes.js {
    height: 52px;
}
.code-boxes.js .code-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    border: none;
    background: transparent;
    font-size: 16px;
    cursor: pointer;
    z-index: 1;
}

/* ---- Wide panel (dashboard, clients) ---- */
.panel-wide {
    max-width: 880px;
}

/* ---- Navigation ---- */
.nav {
    display: flex;
    gap: 16px;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(0,0,0,.1);
}
.nav-link {
    color: var(--muted);
    font-size: .75rem;
    text-decoration: none;
    letter-spacing: .04em;
    background: none;
    border: none;
    padding: 0;
    font-family: var(--font);
    cursor: pointer;
}
.nav-link:hover {
    color: var(--text);
}
.nav-logout {
    margin-left: auto;
}

/* ---- Gmail status panel ---- */
.gmail-status {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    margin: 16px 0 24px;
    background: var(--well);
    border-radius: 8px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,.12);
    font-size: .8rem;
    color: var(--muted);
}
.gmail-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--error);
    flex-shrink: 0;
}

/* ---- Instrument readout table ---- */
.readout {
    width: 100%;
    border-collapse: collapse;
    font-size: .8rem;
    margin: 16px 0;
}
.readout th {
    text-align: left;
    font-weight: 400;
    color: var(--muted);
    padding: 8px 10px;
    border-bottom: 1px solid rgba(0,0,0,.12);
}
.readout td {
    padding: 10px;
    border-bottom: 1px solid rgba(0,0,0,.06);
}
.readout tr:last-child td {
    border-bottom: none;
}

/* ---- Status dot in table ---- */
.status-cell {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-transform: capitalize;
}
.dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
}
.dot.sent { background: var(--text); }
.dot.pending { background: #a08030; }
.dot.failed { background: var(--error); }

/* ---- Add form ---- */
.add-form {
    display: flex;
    gap: 10px;
    margin: 16px 0 24px;
    flex-wrap: wrap;
}
.add-form input {
    flex: 1;
    min-width: 140px;
}

/* ---- Small button ---- */
.btn-small {
    padding: 6px 14px;
    font-size: .7rem;
}

/* ---- Actions column ---- */
.actions {
    text-align: right;
    width: 80px;
}
.actions form {
    display: inline;
}

/* ---- h2 section label ---- */
h2 {
    font-size: .85rem;
    font-weight: 600;
    color: var(--muted);
    letter-spacing: .08em;
    text-transform: uppercase;
    margin: 24px 0 8px;
}

/* ---- Brand header ---- */
.brand-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
}
.brand-mark {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
}

/* ---- Email input (same look as text inputs) ---- */
input[type="email"] {
    width: 100%;
    font-family: var(--font);
    font-size: 1rem;
    padding: 12px 14px;
    border: 1px solid rgba(0,0,0,.15);
    border-radius: 8px;
    background: var(--well);
    color: var(--text);
    box-shadow: inset 0 2px 4px rgba(0,0,0,.12);
    outline: none;
    margin-bottom: 12px;
}
input[type="email"]:focus {
    border-color: rgba(255,255,255,.55);
    box-shadow: inset 0 2px 4px rgba(0,0,0,.12), 0 0 0 2px rgba(255,255,255,.25);
}

/* ---- Add form / actions overrides (must be last) ---- */
.add-form .btn, .actions .btn { width: auto; margin-bottom: 0; }
.add-form input { margin-bottom: 0; }

/* ---- Gmail connected state ---- */
.gmail-status.connected .gmail-dot {
    background: var(--ok);
    box-shadow: 0 0 6px var(--ok);
}

/* ---- Gmail status buttons ---- */
.gmail-status .btn {
    width: auto;
    margin-bottom: 0;
    margin-left: auto;
}
.gmail-status form {
    margin-left: auto;
}

/* ---- PDF drop zone ---- */
.drop-zone {
    position: relative;
    border: 2px dashed rgba(0,0,0,.25);
    border-radius: 8px;
    padding: 28px 20px;
    text-align: center;
    background: var(--well);
    box-shadow: inset 0 2px 4px rgba(0,0,0,.1);
    margin-bottom: 16px;
    overflow: hidden;
}

.drop-zone-label {
    display: none;
    color: var(--muted);
    font-size: .8rem;
    pointer-events: none;
}
.drop-zone.js input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}
.drop-zone.js .drop-zone-label {
    display: block;
}
.drop-zone.js {
    cursor: pointer;
}
.drop-zone.dragover {
    border-color: rgba(255,255,255,.55);
    box-shadow: inset 0 2px 4px rgba(0,0,0,.1), 0 0 0 2px rgba(255,255,255,.25);
}

/* ---- Disabled button ---- */
.btn[disabled] {
    opacity: .5;
    cursor: not-allowed;
}

/* ---- Client pill rows (glass look) ---- */
.client-row {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.client-row .pill {
    position: relative;
    isolation: isolate;
    flex: 1 1 180px;
    border-radius: 999px;
    padding: 1px;
    background: conic-gradient(from var(--glow-angle),
        transparent 0deg,
        rgba(255,255,255,.6) 45deg, rgba(255,255,255,.15) 60deg,
        transparent 90deg,
        transparent 180deg,
        rgba(255,255,255,.6) 225deg, rgba(255,255,255,.15) 240deg,
        transparent 270deg);
}

.client-row .pill-cif {
    flex: 0 1 140px;
}

.client-row .pill:not(.pill-cif) {
    background: conic-gradient(from var(--glow-angle),
        transparent 0deg,
        rgba(255,255,255,.6) 20deg, rgba(255,255,255,.15) 80deg,
        transparent 100deg,
        transparent 180deg,
        rgba(255,255,255,.6) 200deg, rgba(255,255,255,.15) 260deg,
        transparent 280deg);
}

.client-row .pill:not(.pill-cif)::before {
    background: conic-gradient(from var(--glow-angle),
        transparent 0deg,
        rgba(255,255,255,.6) 20deg, rgba(255,255,255,.15) 80deg,
        transparent 100deg,
        transparent 180deg,
        rgba(255,255,255,.6) 200deg, rgba(255,255,255,.15) 260deg,
        transparent 280deg);
}

.client-row .btn-icon.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

.client-row .pill::before {
    content: "";
    position: absolute;
    inset: -2px;
    border-radius: inherit;
    background: conic-gradient(from var(--glow-angle),
        transparent 0deg,
        rgba(255,255,255,.6) 45deg, rgba(255,255,255,.15) 60deg,
        transparent 90deg,
        transparent 180deg,
        rgba(255,255,255,.6) 225deg, rgba(255,255,255,.15) 240deg,
        transparent 270deg);
    filter: blur(6px);
    opacity: .6;
    z-index: -1;
}

.client-row .pill:hover::before,
.client-row .pill:focus-within::before {
    opacity: 1;
}

.client-row .pill input[type="text"],
.client-row .pill input[type="email"] {
    display: block;
    width: 100%;
    height: 40px;
    font-family: var(--font);
    font-size: .85rem;
    padding: 0 16px;
    border: none;
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(255,255,255,.35), rgba(255,255,255,.10));
    color: var(--text);
    outline: none;
    margin: 0;
    box-shadow: none;
}

.client-row .pill input[type="text"]:focus,
.client-row .pill input[type="email"]:focus {
    background: linear-gradient(180deg, rgba(255,255,255,.45), rgba(255,255,255,.15));
    box-shadow: none;
}

@property --glow-angle {
    syntax: '<angle>';
    initial-value: 0deg;
    inherits: true;
}

.client-row .pill {
    animation: glow-spin 8s linear infinite;
    animation-play-state: paused;
}
.client-row .pill:hover,
.client-row .pill:focus-within {
    animation-play-state: running;
}

@keyframes glow-spin {
    to { --glow-angle: 360deg; }
}

@media (prefers-reduced-motion: reduce) {
    .client-row .pill,
    .code-boxes .code-box,
    .btn-primary { animation: none; }
}

.client-row .btn-icon,
.client-row .btn-icon.btn-primary {
    width: 40px;
    height: 40px;
    padding: 0;
    margin: 0;
    flex-shrink: 0;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, rgba(255,255,255,.35), rgba(255,255,255,.10));
    border: 1px solid rgba(255,255,255,.55);
    box-shadow: 0 0 6px rgba(255,255,255,.35);
}
.client-row .btn-icon:hover,
.client-row .btn-icon.btn-primary:hover {
    border-color: rgba(255,255,255,.8);
    box-shadow: 0 0 10px rgba(255,255,255,.5);
}
.client-row .btn-icon svg {
    width: 16px;
    height: 16px;
}
.client-row .btn-primary {
    color: var(--text);
}
.client-row .btn-danger {
    color: var(--error);
}
.client-row .btn-icon:not(.btn-primary):not(.btn-danger) {
    color: var(--text);
}

.client-list {
    margin-top: 16px;
}

/* ---- Language toggle ---- */
.lang-toggle {
    position: absolute;
    top: 12px;
    right: 44px;
    display: flex;
    gap: 6px;
    z-index: 2;
}
.lang-btn {
    width: 32px;
    height: 24px;
    padding: 2px;
    margin: 0;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, rgba(255,255,255,.35), rgba(255,255,255,.10));
    border: 1px solid rgba(255,255,255,.55);
    box-shadow: 0 0 6px rgba(255,255,255,.35);
    cursor: pointer;
    opacity: .6;
}
.lang-btn.active {
    opacity: 1;
    border-color: rgba(255,255,255,.8);
    box-shadow: 0 0 10px rgba(255,255,255,.5);
}
.lang-btn:hover {
    opacity: .9;
}

/* ---- Login page redesign ---- */
.login-title {
    text-align: center;
    font-size: 1.15rem;
    font-weight: 600;
    margin: 20px 0 16px;
}

.panel .qr-plate {
    width: fit-content;
    margin: 20px auto;
    padding: 16px;
    background: radial-gradient(closest-side, rgba(255,255,255,.75) 70%, rgba(255,255,255,0) 100%);
    box-shadow: none;
    border-radius: 0;
}

.panel .qr-plate svg {
    width: 300px;
    max-width: 100%;
    height: auto;
    color: var(--text);
    display: block;
}

.panel .qr-logo {
    background: var(--chrome-hi);
}

/* ---- Brand name ---- */
.brand-name {
    text-transform: none;
    letter-spacing: .06em;
    font-size: .72rem;
}
.brand-header .brand-name {
    margin: 0;
    line-height: 1;
}
.brand-header .brand-mark {
    width: 22px;
    height: 22px;
}
.brand-header {
    margin-top: -20px;
    margin-bottom: 18px;
}

/* ---- Sent-before note ---- */
.readout .sent-before {
    color: #a08030;
    font-size: .68rem;
}

/* ---- Dashboard history trash buttons (glass look) ---- */
.readout .actions {
    text-align: right;
    width: 50px;
}
.readout .actions form {
    display: inline;
}
.readout .btn-icon,
.readout .btn-icon.btn-primary {
    width: 32px;
    height: 32px;
    padding: 0;
    margin: 0;
    flex-shrink: 0;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, rgba(255,255,255,.35), rgba(255,255,255,.10));
    border: 1px solid rgba(255,255,255,.55);
    box-shadow: 0 0 6px rgba(255,255,255,.35);
}
.readout .btn-icon:hover,
.readout .btn-icon.btn-primary:hover {
    border-color: rgba(255,255,255,.8);
    box-shadow: 0 0 10px rgba(255,255,255,.5);
}
.readout .btn-icon svg {
    width: 14px;
    height: 14px;
}
.readout .btn-danger {
    color: var(--error);
}
.history-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.history-head h2 {
    margin: 24px 0 8px;
}
.clean-all-form {
    display: inline-block;
    margin: 0;
}
.clean-all-form .btn-icon {
    width: auto;
    height: 32px;
    padding: 0 14px;
    margin: 0;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(180deg, rgba(255,255,255,.35), rgba(255,255,255,.10));
    border: 1px solid rgba(255,255,255,.55);
    box-shadow: 0 0 6px rgba(255,255,255,.35);
    color: var(--error);
    font-size: .75rem;
}

/* ---- Batch page ---- */
.batch-summary {
    font-size: .8rem;
    color: var(--muted);
    margin: 16px 0;
}
.readout small {
    color: var(--muted);
    font-size: .7rem;
}
