/* NEDZO component classes.
   Tailwind (CDN) handles utilities; these are the few repeated compositions.
   No build step, no npm - plain CSS on purpose. */

:root {
    --nz-ink: #0f172a;
    --nz-ring: #cbd5e1;
}

/* Buttons ------------------------------------------------------------------ */
.btn-primary,
.btn-secondary,
.btn-danger,
.btn-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    border-radius: .5rem;
    padding: .5rem 1rem;
    font-size: .875rem;
    font-weight: 600;
    line-height: 1.25rem;
    cursor: pointer;
    transition: background-color .15s ease, color .15s ease, border-color .15s ease;
    white-space: nowrap;
}

.btn-primary { background: var(--nz-ink); color: #fff; border: 1px solid var(--nz-ink); }
.btn-primary:hover { background: #1e293b; }
.btn-secondary { background: #fff; color: #334155; border: 1px solid var(--nz-ring); }
.btn-secondary:hover { background: #f8fafc; }
.btn-danger { background: #e11d48; color: #fff; border: 1px solid #e11d48; }
.btn-danger:hover { background: #be123c; }
.btn-ghost { background: transparent; color: #334155; border: 1px solid transparent; }
.btn-ghost:hover { background: #f1f5f9; }

.btn-primary:disabled,
.btn-secondary:disabled,
.btn-danger:disabled,
.btn-ghost:disabled { opacity: .55; cursor: not-allowed; }

/* Forms ------------------------------------------------------------------- */
.field-label {
    display: block;
    font-size: .8125rem;
    font-weight: 600;
    color: #334155;
    margin-bottom: .375rem;
}

.field-input,
.field-select,
.field-textarea {
    width: 100%;
    border-radius: .5rem;
    border: 1px solid var(--nz-ring);
    background-color: #fff;
    padding: .5rem .75rem;
    font-size: .875rem;
    line-height: 1.25rem;
    color: #0f172a;
}

/* Selects: the native arrow is drawn by the OS, so its glyph, weight and offset
   differ per platform and it crowds the border because `padding-right` reserves
   no room for it. Suppress it and paint one chevron we control, with matching
   right padding, so every dropdown in the app looks identical everywhere. */
.field-select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    padding-right: 2.25rem;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%2364748b' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right .625rem center;
    background-size: 1.125rem 1.125rem;
}

/* Firefox keeps a focus-ring artefact on the option text; Edge/IE draw their own
   expand button. Neither should survive the custom chevron. */
.field-select::-ms-expand { display: none; }
.field-select:-moz-focusring { color: transparent; text-shadow: 0 0 0 #0f172a; }

/* A multi-select is a list box, not a dropdown - it has no arrow to replace. */
.field-select[multiple] {
    background-image: none;
    padding-right: .75rem;
}

.field-select:disabled {
    background-color: #f8fafc;
    color: #94a3b8;
    cursor: not-allowed;
}

.field-input:focus,
.field-select:focus,
.field-textarea:focus {
    outline: 2px solid rgba(15, 23, 42, .15);
    border-color: #94a3b8;
}

.field-textarea { min-height: 6rem; resize: vertical; }
.field-hint { margin-top: .25rem; font-size: .75rem; color: #64748b; }
.field-error { margin-top: .25rem; font-size: .75rem; color: #e11d48; min-height: 1rem; }

/* Nav --------------------------------------------------------------------- */
.nav-link {
    padding: .375rem .625rem;
    border-radius: .5rem;
    font-size: .875rem;
    font-weight: 500;
    color: #475569;
}
.nav-link:hover { background: #f1f5f9; color: #0f172a; }
.nav-link-active { background: #0f172a; color: #fff; }
.nav-link-active:hover { background: #1e293b; color: #fff; }

/* Pager ------------------------------------------------------------------- */
.pager-btn {
    min-width: 2.25rem;
    padding: .375rem .5rem;
    border-radius: .5rem;
    border: 1px solid var(--nz-ring);
    background: #fff;
    font-size: .8125rem;
    font-weight: 600;
    color: #334155;
    cursor: pointer;
}
.pager-btn:hover:not(:disabled) { background: #f8fafc; }
.pager-btn:disabled { opacity: .45; cursor: not-allowed; }
.pager-btn-active { background: #0f172a; border-color: #0f172a; color: #fff; }

/* Tables ------------------------------------------------------------------ */
.data-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .875rem; }
.data-table thead th {
    text-align: left;
    font-size: .6875rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: #64748b;
    padding: .625rem .75rem;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    white-space: nowrap;
}
.data-table tbody td { padding: .75rem; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.data-table tbody tr:hover { background: #f8fafc; }
.table-wrap { overflow-x: auto; border: 1px solid #e2e8f0; border-radius: .75rem; background: #fff; }

/* Popovers ---------------------------------------------------------------- */
/* One visual treatment for every floating menu: the share targets popover and
   the table row action menu. */
.pop-menu {
    position: absolute;
    z-index: 60;
    min-width: 11rem;
    padding: .375rem;
    border-radius: .75rem;
    border: 1px solid #e2e8f0;
    background: #fff;
    box-shadow: 0 10px 30px -10px rgba(15, 23, 42, .25), 0 2px 6px rgba(15, 23, 42, .06);
}

.pop-menu-item {
    display: flex;
    align-items: center;
    gap: .625rem;
    width: 100%;
    padding: .5rem .625rem;
    border: 0;
    border-radius: .5rem;
    background: transparent;
    font-size: .875rem;
    font-weight: 500;
    color: #334155;
    text-align: left;
    cursor: pointer;
}
.pop-menu-item:hover,
.pop-menu-item:focus-visible { background: #f1f5f9; color: #0f172a; outline: none; }

.pop-menu-icon {
    display: grid;
    place-items: center;
    width: 1.5rem;
    height: 1.5rem;
    flex: none;
    border-radius: .375rem;
    background: #f1f5f9;
    font-size: .75rem;
    font-weight: 700;
    color: #0f172a;
}

/* Table row actions ------------------------------------------------------- */
/* One trigger per row instead of a wall of buttons. The panel is `fixed` and
   positioned by U.bindRowMenus(), so `.table-wrap`'s horizontal scrolling cannot
   clip it, while the buttons stay inside the row in the DOM - page code binds
   them exactly as it did when they were laid out in the cell. */
.row-menu { display: inline-block; }

.row-menu-trigger {
    display: inline-flex;
    align-items: center;
    gap: .375rem;
    padding: .375rem .625rem;
    border: 1px solid var(--nz-ring);
    border-radius: .5rem;
    background: #fff;
    font-size: .8125rem;
    font-weight: 600;
    color: #334155;
    cursor: pointer;
    white-space: nowrap;
}
.row-menu-trigger:hover { background: #f8fafc; }
.row-menu-trigger[aria-expanded="true"] { background: #0f172a; border-color: #0f172a; color: #fff; }
.row-menu-caret { font-size: .625rem; line-height: 1; }

.row-menu-panel {
    position: fixed;
    z-index: 60;
    display: flex;
    flex-direction: column;
    min-width: 11rem;
    padding: .375rem;
    border-radius: .75rem;
    border: 1px solid #e2e8f0;
    background: #fff;
    box-shadow: 0 10px 30px -10px rgba(15, 23, 42, .25), 0 2px 6px rgba(15, 23, 42, .06);
}
.row-menu-panel[hidden] { display: none; }

/* Normalise whatever button/link classes the page already used into menu rows,
   so wrapping existing markup needs no per-button edits. */
.row-menu-panel > button,
.row-menu-panel > a {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: .5rem;
    width: 100%;
    margin: 0;
    padding: .5rem .625rem;
    border: 0 !important;
    border-radius: .5rem;
    background: transparent !important;
    font-size: .8125rem;
    font-weight: 500;
    color: #334155 !important;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
}
.row-menu-panel > button:hover,
.row-menu-panel > a:hover,
.row-menu-panel > button:focus-visible,
.row-menu-panel > a:focus-visible {
    background: #f1f5f9 !important;
    color: #0f172a !important;
    outline: none;
}
.row-menu-panel > .btn-danger { color: #e11d48 !important; }
.row-menu-panel > .btn-danger:hover { background: #fff1f2 !important; color: #be123c !important; }
.row-menu-panel > button:disabled { opacity: .5; cursor: not-allowed; }

/* Header account menu - reuses .row-menu / .row-menu-panel so there is exactly one
   floating-menu implementation, with its own trigger skin. */
.user-menu-trigger {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .25rem .5rem .25rem .25rem;
    border: 1px solid transparent;
    border-radius: 9999px;
    background: transparent;
    font-size: .875rem;
    font-weight: 500;
    color: #334155;
    cursor: pointer;
    max-width: 13rem;
    white-space: nowrap;
}
.user-menu-trigger > span:not(.user-avatar) { overflow: hidden; text-overflow: ellipsis; }
.user-menu-trigger:hover { background: #f8fafc; border-color: var(--nz-ring); }
.user-menu-trigger[aria-expanded="true"] { background: #f1f5f9; border-color: var(--nz-ring); }
.user-menu-trigger:focus-visible { outline: 2px solid #0f172a; outline-offset: 2px; }

.user-avatar {
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
    height: 2rem;
    width: 2rem;
    border-radius: 9999px;
    background: #0f172a;
    color: #fff;
    font-size: .8125rem;
    font-weight: 700;
    line-height: 1;
    text-transform: uppercase;
}

/* Unread count inside the menu row, pushed to the far edge. */
.user-menu-badge {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.25rem;
    height: 1.25rem;
    padding: 0 .25rem;
    border-radius: 9999px;
    background: #e11d48;
    color: #fff;
    font-size: .6875rem;
    font-weight: 700;
}

/* Primary destination in the account menu (admin console), separated from the
   ordinary rows below it. */
.row-menu-panel > .user-menu-primary {
    margin-bottom: .25rem;
    padding-bottom: .5rem;
    border-bottom: 1px solid #e2e8f0 !important;
    border-radius: .5rem .5rem 0 0;
    font-weight: 600;
    color: #0f172a !important;
}

/* A button that reads as a link - used for in-place mode switches (auth screens)
   where a navigation would lose the form state. */
.link-button {
    background: none;
    border: 0;
    padding: 0;
    font: inherit;
    font-weight: 500;
    color: #0f172a;
    text-decoration: underline;
    text-decoration-color: #cbd5e1;
    text-underline-offset: 4px;
    cursor: pointer;
}
.link-button:hover { text-decoration-color: #0f172a; }
.link-button:disabled { color: #94a3b8; text-decoration: none; cursor: not-allowed; }
.link-button:focus-visible { outline: 2px solid #0f172a; outline-offset: 2px; border-radius: .25rem; }

/* Misc -------------------------------------------------------------------- */
.masked-mobile { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .1em; }
.line-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
