:root {
    --ink: #183247;
    --navy: #102d3e;
    --navy-light: #1d4656;
    --teal: #137c85;
    --gold: #d8ae72;
    --surface: #f5f7f8;
    --line: #e4ebed;
}
body { background: var(--surface); color: var(--ink); font-family: system-ui, -apple-system, "Segoe UI", sans-serif; }
a { text-decoration: none; }
.muted { color: #70838d; }
.eyebrow { color: #a4773e; font-size: .72rem; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.brand { display: inline-flex; align-items: center; gap: .75rem; color: var(--ink); font-weight: 800; font-size: .82rem; letter-spacing: .13em; white-space: nowrap; }
.brand:hover { color: var(--teal); }
.brand-mark { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--navy); color: white; font-family: Georgia, serif; letter-spacing: -.08em; font-size: 1rem; }
.btn-primary { --bs-btn-bg: var(--teal); --bs-btn-border-color: var(--teal); --bs-btn-hover-bg: #0e626a; --bs-btn-hover-border-color: #0e626a; --bs-btn-active-bg: #0e626a; --bs-btn-active-border-color: #0e626a; }
.btn-outline-primary { --bs-btn-color: var(--teal); --bs-btn-border-color: #c5dadd; --bs-btn-hover-bg: var(--teal); --bs-btn-hover-border-color: var(--teal); }
.form-control { min-height: 46px; border-color: #dbe4e7; border-radius: .65rem; }
.form-control:focus { border-color: #63a6ad; box-shadow: 0 0 0 .2rem #137c8520; }
.form-label { color: #3d5360; font-weight: 650; font-size: .86rem; }
.form-check-input:checked { background-color: var(--teal); border-color: var(--teal); }
.card { border: 1px solid var(--line) !important; border-radius: 1rem; box-shadow: 0 10px 32px #15374c0a; padding: 1.75rem; }
.card h2 { font-size: 1.35rem; font-weight: 730; letter-spacing: -.025em; }
.card h3 { color: var(--navy-light); font-size: .86rem; font-weight: 750; margin: 1.75rem 0 1rem; }
.card-header { background: transparent; border: 0; padding: 0; display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1.3rem; }
.card-header h2 { margin: 0; }
.count { border-radius: 10rem; padding: .3rem .65rem; color: #176a72; background: #e1f1f0; font-size: .76rem; font-weight: 750; }

/* Login */
.login-layout { min-height: 100vh; }
.intro { position: relative; overflow: hidden; min-height: 100vh; background: linear-gradient(145deg, #102e40 7%, #174e60 74%, #137c85 140%); color: white; padding: clamp(2rem, 5vw, 5rem); display: flex; flex-direction: column; justify-content: space-between; }
.intro::before, .intro::after { content: ""; position: absolute; pointer-events: none; border: 1px solid #ffffff24; border-radius: 50%; width: 60vw; height: 60vw; min-width: 560px; min-height: 560px; right: -35%; bottom: -40%; }
.intro::after { width: 47vw; height: 47vw; min-width: 430px; min-height: 430px; right: -25%; bottom: -25%; }
.intro > * { position: relative; z-index: 1; }
.intro .brand { color: white; }
.intro .brand-mark { border: 1px solid #ffffff70; background: #ffffff15; }
.intro .eyebrow { color: #e4bf87; }
.intro h1 { font-family: Georgia, serif; font-size: clamp(3rem, 5vw, 5.3rem); line-height: 1.08; letter-spacing: -.04em; margin: 1.2rem 0; }
.intro h1 em { font-weight: 400; color: #e7c593; }
.intro-copy { max-width: 570px; }
.intro-copy p { max-width: 420px; color: #cae0e5; line-height: 1.8; }
.intro-footer { color: #b7d2d9; font-size: .68rem; font-weight: 650; letter-spacing: .13em; }
.login-panel { min-width: 0; min-height: 100vh; padding: 2rem; background: #fbfcfc; display: grid; place-items: center; grid-template-columns: minmax(0, 1fr); }
.login-card { width: 100%; max-width: 430px; min-width: 0; justify-self: center; }
.login-card h2 { font-size: clamp(2rem, 3vw, 2.7rem); font-weight: 750; letter-spacing: -.045em; margin: .7rem 0; }
.login-card .muted { line-height: 1.65; }
.login-card .btn { min-height: 50px; }
.login-help { color: #82969e; font-size: .8rem; }

/* Shell and navigation */
.topbar { min-height: 76px; background: white; border-bottom: 1px solid var(--line); padding: .85rem clamp(1rem, 3vw, 2.5rem); display: flex; justify-content: space-between; align-items: center; gap: 1rem; position: relative; z-index: 5; }
.topbar .account { display: flex; align-items: center; justify-content: end; gap: 1rem; font-size: .85rem; }
.account-name { max-width: 220px; overflow-wrap: anywhere; line-height: 1.25; font-weight: 700; }
.account-name small { color: #82949d; font-size: .72rem; font-weight: 500; }
.profile-link { color: var(--navy-light); font-weight: 650; white-space: nowrap; }
.profile-link:hover, .profile-link.current { color: var(--teal); }
.app-layout { min-height: calc(100vh - 76px); display: grid; grid-template-columns: 248px minmax(0, 1fr); }
.sidebar { background: var(--navy); color: white; padding: 2rem .9rem; }
.sidebar.offcanvas-lg { --bs-offcanvas-bg: var(--navy); background-color: var(--navy) !important; }
.sidebar .offcanvas-body { display: block; padding: 0; }
.sidebar-label { color: #89aab5; font-size: .68rem; letter-spacing: .16em; font-weight: 750; padding: 0 .9rem; margin-bottom: 1.2rem; }
.sidebar nav { display: grid; gap: .28rem; }
.sidebar .nav-link, .sidebar .nav-group summary { color: #d1e0e4; display: flex; align-items: center; gap: .75rem; border-radius: .7rem; padding: .78rem .9rem; font-size: .87rem; font-weight: 600; min-height: 45px; }
.sidebar .nav-link:hover, .sidebar .nav-group summary:hover { color: white; background: #ffffff12; }
.sidebar .nav-link.selected, .sidebar .nav-group summary.selected { background: #ffffff1c; color: white; }
.sidebar .nav-link.selected::before { content: ""; width: 3px; height: 22px; background: var(--gold); position: absolute; left: 0; border-radius: 0 3px 3px 0; }
.sidebar .nav-link { position: relative; }
.sidebar .bi { font-size: 1.08rem; opacity: .88; }
.sidebar .nav-group summary { cursor: pointer; list-style: none; justify-content: space-between; }
.sidebar .nav-group summary::-webkit-details-marker { display: none; }
.sidebar .nav-group summary::after { content: "+"; font-size: 1.2rem; font-weight: 400; margin-left: auto; }
.sidebar .nav-group[open] summary::after { content: "-"; }
.sidebar .nav-submenu { margin: .15rem 0 .55rem 1.45rem; border-left: 1px solid #ffffff26; padding-left: .4rem; }
.sidebar .nav-submenu .nav-link { font-size: .8rem; min-height: 39px; padding: .55rem .85rem; }
.dashboard { width: min(100%, 1450px); min-width: 0; margin: 0 auto; padding: clamp(1.5rem, 4vw, 3rem); }
.page-heading { display: flex; justify-content: space-between; align-items: end; flex-wrap: wrap; gap: 1rem; margin-bottom: 1.8rem; }
.page-heading h1 { font-size: clamp(2rem, 3vw, 2.9rem); line-height: 1.15; letter-spacing: -.05em; font-weight: 760; margin: .35rem 0; }
.page-heading p { margin: 0; }
.workspace { display: grid; grid-template-columns: minmax(250px, 310px) minmax(0, 1fr); align-items: start; gap: 1.25rem; }
.list-card { padding: 0; overflow: hidden; }
.list-card .card-header { padding: 1.45rem 1.35rem 0; margin-bottom: 1rem; }
.owner-list { max-height: 700px; overflow: auto; }
.owner-item { display: flex; gap: .75rem; align-items: center; padding: .9rem 1.25rem; border-top: 1px solid #edf1f2; color: var(--ink); font-size: .82rem; }
.owner-item:hover, .owner-item.active { background: #eaf6f5; color: var(--ink); }
.owner-item > span:nth-child(2) { min-width: 0; flex: 1; }
.owner-item strong, .owner-item small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.owner-item small { color: #82949d; margin-top: .2rem; }
.avatar { flex: 0 0 37px; width: 37px; height: 37px; display: grid; place-items: center; background: #e1eeef; color: #176f77; border-radius: .7rem; font-weight: 750; }
.empty { padding: 0 1.3rem 1.5rem; }
.client-item[hidden] { display: none; }
.quality-item[hidden] { display: none; }
.quality-code { display: inline-block; border-radius: .65rem; color: var(--teal); background: #e6f4f2; padding: .5rem .8rem; font-size: .8rem; font-weight: 750; white-space: nowrap; }
.quality-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .6rem; }
.quality-detail .card-header > div:first-child { min-width: 0; }
.quality-form { border-top: 1px solid var(--line); padding-top: 1.4rem; }
.quality-note { color: #7c8f97; font-size: .79rem; }
.ddt-fish-row { border: 1px solid var(--line); border-radius: .8rem; padding: 1rem .7rem; margin-left: 0; margin-right: 0; background: #fbfdfd; }
.ddt-boat-banner { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .9rem 1.2rem; margin-bottom: 1rem !important; background: #eaf5f3; border-color: #d5eae5; }
.ddt-boat-banner h2 { font-size: 1.1rem; margin-top: .2rem !important; line-height: 1.2; }
.ddt-boat-banner p { font-size: .8rem; }
.ddt-boat-banner > .bi { color: var(--teal); font-size: 1.35rem; }
.ddt-form-card { padding: 1.25rem 1.5rem; }
.ddt-form-card > .card-header { margin-bottom: .85rem; }
.ddt-form-card > .card-header h2 { font-size: 1.1rem; margin-top: .2rem !important; }
.ddt-fish-row .fish-description, .ddt-fish-row .fish-lot { min-height: 46px; padding: .65rem .7rem; border-radius: .65rem; background: #ecf4f4; color: var(--navy-light); font-size: .82rem; line-height: 1.45; overflow-wrap: anywhere; }
.ddt-fish-row .fish-lot { color: var(--teal); font-weight: 700; }
.fish-picker { position: relative; min-width: 0; }
.fish-suggestions { position: absolute; z-index: 30; top: 100%; left: .5rem; right: .5rem; max-height: 260px; overflow-y: auto; background: white; border: 1px solid var(--line); border-radius: .7rem; box-shadow: 0 14px 28px #15374c22; }
.fish-suggestions[hidden] { display: none; }
.fish-suggestion { display: block; width: 100%; padding: .65rem .75rem; border: 0; border-bottom: 1px solid var(--line); background: white; color: var(--ink); text-align: left; font-size: .83rem; }
.fish-suggestion:last-child { border-bottom: 0; }
.fish-suggestion:hover, .fish-suggestion.active { background: #eaf6f5; }
.fish-suggestion strong { color: var(--teal); margin-right: .35rem; }
.fish-suggestion small { display: block; color: var(--navy-light); }
.ddt-add-control { width: min(340px, 100%); }
.ddt-add-control .btn { width: 100%; }
.ddt-added-summary { max-height: 130px; overflow-y: auto; margin-top: .4rem; padding: .4rem .55rem; border: 1px solid var(--line); border-radius: .6rem; background: #f2f9f8; font-size: .75rem; line-height: 1.35; }
.ddt-added-summary[hidden] { display: none; }
.ddt-summary-item { display: flex; justify-content: space-between; gap: .4rem; padding: .2rem 0; }
.ddt-summary-name { min-width: 0; overflow-wrap: anywhere; }
.ddt-summary-colli { flex-shrink: 0; color: var(--teal); white-space: nowrap; }
.ddt-mobile-actions { display: none; }
.ddt-result code { color: var(--teal); white-space: nowrap; }
.ddt-result .table { min-width: 720px; }
.ddt-recent-link { color: var(--navy); min-width: 0; }
.ddt-recent-link:hover { color: var(--teal); }
.ddt-vettore[hidden] { display: none !important; }
.client-search { padding: 0 1.3rem 1rem; }
.client-search .form-label { font-size: .76rem; }
.client-placeholder { align-self: start; }
.client-placeholder p { line-height: 1.7; max-width: 460px; }
.created-at { font-size: .78rem; }
.flags { display: flex; flex-wrap: wrap; gap: 1rem; }
.client-password { max-width: 450px; }
.destination-heading { display: flex; align-items: end; justify-content: space-between; flex-wrap: wrap; gap: 1rem; margin: 2rem 0 1rem; }
.destination-heading h3 { margin: 0 0 .35rem; }
.destination-heading p { font-size: .81rem; margin: 0; }
.destination-card { border: 1px solid var(--line); border-radius: .8rem; min-width: 0; margin-bottom: 1rem; padding: 1.1rem; }
.destination-card legend { float: none; width: auto; padding: 0 .5rem; font-size: .83rem; color: var(--teal); font-weight: 750; }
.destination-options { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .8rem; margin-top: 1rem; }
.form-actions { margin-top: 1.5rem; }
.delete-form { border-top: 1px solid var(--line); margin-top: 1.5rem; padding-top: 1rem; }
.detail-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.detail { border-top: 1px solid var(--line); padding: 1rem 0 .3rem; }
.detail span, .detail strong { display: block; overflow-wrap: anywhere; }
.detail span { color: #82949d; font-size: .77rem; }
.detail strong { font-size: .88rem; font-weight: 650; margin-top: .3rem; }
.password-card { margin-top: 1.25rem; }
.password-form { display: flex; flex-wrap: wrap; align-items: end; gap: 1rem; }
.password-form label { flex: 1 1 190px; }
.password-form .btn { min-height: 46px; }
.coming-soon { max-width: 690px; }
.status-badge { display: inline-block; color: #956a33; background: #fff4e5; border-radius: 2rem; padding: .45rem .8rem; font-size: .75rem; font-weight: 750; }

/* Dashboard */
.dashboard-welcome { position: relative; overflow: hidden; padding: clamp(1.6rem, 4vw, 3rem); background: linear-gradient(120deg, #123849, #1c5966); border-radius: 1.2rem; color: white; }
.dashboard-welcome::after { content: ""; position: absolute; width: 250px; height: 250px; border: 1px solid #ffffff30; border-radius: 50%; right: -70px; top: -90px; box-shadow: 0 0 0 58px #ffffff08, 0 0 0 115px #ffffff06; }
.dashboard-welcome > * { position: relative; z-index: 1; }
.dashboard-welcome .eyebrow { color: #e7c593; }
.dashboard-welcome h2 { font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 740; letter-spacing: -.035em; }
.dashboard-welcome p { color: #d1e3e6; margin-bottom: 0; }
.section-heading { margin: 2rem 0 1rem; }
.section-heading h2 { font-size: 1.25rem; font-weight: 750; }
.quick-card { display: flex; flex-direction: column; max-width: 390px; min-height: 220px; padding: 1.6rem; border: 1px solid var(--line); border-radius: 1rem; color: var(--ink); background: white; box-shadow: 0 10px 32px #15374c0a; transition: transform .15s, box-shadow .15s; }
.quick-card:hover { color: var(--ink); transform: translateY(-3px); box-shadow: 0 16px 35px #15374c18; }
.quick-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: .8rem; color: var(--teal); background: #e6f4f2; font-size: 1.3rem; margin-bottom: 1.2rem; }
.quick-title { font-size: 1.2rem; font-weight: 750; }
.quick-description { color: #758a93; font-size: .86rem; margin: .4rem 0 1.2rem; }
.quick-bottom { display: flex; justify-content: space-between; color: var(--teal); font-size: .8rem; font-weight: 750; margin-top: auto; }
@media (max-width: 1199px) {
    .workspace { grid-template-columns: minmax(0, 1fr); }
    .owner-list { max-height: 260px; }
}
@media (max-width: 991.98px) {
    .app-layout { display: block; }
    .sidebar { width: min(290px, 86vw) !important; }
    .sidebar .offcanvas-body { display: block; }
    .login-layout .intro { min-height: 300px; }
    .login-layout .intro h1 { font-size: clamp(2.5rem, 7vw, 3.3rem); }
    .login-panel { min-height: auto; padding: 3rem 1.5rem; }
}
@media (max-width: 767.98px) {
    body:has(#ddt-form) .dashboard { padding-bottom: calc(7rem + env(safe-area-inset-bottom)); }
    body:has(.ddt-mobile-actions .ddt-added-summary:not([hidden])) .dashboard { padding-bottom: calc(13rem + env(safe-area-inset-bottom)); }
    #ddt-form { display: flex; flex-direction: column; gap: .9rem; }
    .ddt-primary-row { display: contents; }
    .ddt-primary-row > .form-label { width: 100%; padding: 0; margin: 0; }
    .destination-heading { order: 0; display: flex; flex-direction: column; align-items: stretch; margin: 0; }
    .destination-heading h3 { margin: 0 0 .35rem; }
    .destination-heading .ddt-add-control { order: -1; width: 100%; }
    .destination-heading #add-fish { width: 100%; min-height: 50px; background: var(--teal); border-color: var(--teal); color: white; }
    .destination-heading #add-fish:hover { background: #0e626a; }
    .ddt-date-field { order: 1; }
    #ddt-rows { order: 2; }
    .ddt-lot-note { order: 3; }
    .ddt-client-field { order: 4; }
    .ddt-destination-field { order: 5; }
    #ddt-no-destination { order: 6; }
    .ddt-transport-fields { order: 7; margin-top: 0 !important; }
    .ddt-desktop-save { display: none; }
    .ddt-cancel-edit { order: 8; margin-left: 0 !important; }
    .ddt-mobile-actions { position: fixed; z-index: 1040; left: 0; right: 0; bottom: 0; display: flex; gap: .65rem; padding: .75rem max(1rem, env(safe-area-inset-right)) calc(.75rem + env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left)); background: #fff; border-top: 1px solid var(--line); box-shadow: 0 -8px 25px #15374c1c; }
    .ddt-mobile-actions .btn { flex: 1 1 0; min-width: 0; min-height: 48px; padding: .5rem .25rem; font-size: .84rem; font-weight: 700; }
    .ddt-mobile-add { flex: 1 1 0; min-width: 0; }
    .ddt-mobile-add .btn { width: 100%; }
    .ddt-mobile-actions > .btn { align-self: flex-start; }
    .ddt-mobile-actions .ddt-added-summary { max-height: 76px; font-size: .69rem; }
    .fish-suggestions { position: relative; left: auto; right: auto; top: auto; margin-top: .35rem; max-height: min(32vh, 240px); box-shadow: 0 8px 20px #15374c16; }
    .fish-picker input { scroll-margin-bottom: 8rem; }
}
@media (max-width: 575.98px) {
    .topbar { flex-wrap: wrap; padding: .8rem 1rem; }
    .topbar .account { width: 100%; justify-content: space-between; flex-wrap: wrap; gap: .6rem; }
    .account-name { max-width: 100%; }
    .topbar .brand { font-size: .71rem; }
    .dashboard { padding: 1.3rem 1rem 3rem; }
    .page-heading { align-items: start; }
    .page-heading .btn { width: 100%; }
    .card { padding: 1.2rem; }
    .ddt-boat-banner { padding: .7rem .9rem; margin-bottom: .75rem !important; }
    .ddt-form-card { padding: 1rem; }
    .ddt-form-card > .card-header { margin-bottom: .7rem; }
    .list-card { padding: 0; }
    .detail-grid { grid-template-columns: 1fr; }
    .quick-card { max-width: none; }
    .intro { padding: 1.7rem; }
    .intro-copy p, .intro-footer { display: none; }
    .login-layout .intro { min-height: 240px; }
}
