:root {
  --navy: #03111d;
  --navy-soft: #08253a;
  --turquoise: #19c6c8;
  --gold: #e6b75b;
  --muted: #758291;
  --danger: #c64f4f;
  --shadow: 0 22px 65px rgba(0, 14, 26, 0.22);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 300px; font-family: Inter, "Segoe UI", Arial, sans-serif; color: var(--navy); background: #edf3f5; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.login-screen { min-height: 100svh; display: grid; place-items: center; padding: 5rem 1.25rem 2rem; position: relative; overflow: hidden; background: var(--navy); }
.login-photo, .login-overlay, .captain-background { position: fixed; inset: 0; pointer-events: none; }
.login-photo { background: url("assets/captain-huseyin.jpg") center 35% / cover no-repeat; }
.login-overlay { background: linear-gradient(110deg, rgba(1, 11, 19, .97) 10%, rgba(2, 21, 35, .82) 55%, rgba(2, 20, 34, .46)); }
.back-link { position: absolute; z-index: 2; top: 1.25rem; left: 1.25rem; color: white; text-decoration: none; }
.login-card { z-index: 1; width: min(440px, 100%); padding: 2rem; border: 1px solid rgba(255,255,255,.16); border-radius: 24px; color: white; background: rgba(4, 24, 39, .88); box-shadow: var(--shadow); backdrop-filter: blur(16px); }
.login-card h1 { margin: .35rem 0 .75rem; font-size: clamp(2rem, 7vw, 3rem); line-height: 1; }
.login-card > p:not(.eyebrow) { color: #c7d4da; }
.panel-brand { display: flex; gap: .75rem; align-items: center; }
.brand-mark { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; color: var(--navy); font-weight: 900; background: linear-gradient(135deg, var(--gold), #fff0a6); }
.panel-brand span:last-child { display: grid; line-height: 1.05; }
.panel-brand small { letter-spacing: .11em; font-size: .64rem; }
.eyebrow { margin: 1.6rem 0 0; color: var(--turquoise); font-size: .73rem; font-weight: 800; letter-spacing: .16em; }
label { display: grid; gap: .45rem; color: #40505d; font-size: .86rem; font-weight: 700; }
.login-card label { color: #d9e5ea; margin-top: 1rem; }
input, select, textarea { width: 100%; border: 1px solid #cdd8dd; border-radius: 12px; padding: .85rem .95rem; color: var(--navy); background: white; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--turquoise); box-shadow: 0 0 0 3px rgba(25,198,200,.15); }
input[readonly] { background: #edf3f5; color: #586773; }
.primary-button, .secondary-button, .danger-button, .logout-button { border: 0; border-radius: 12px; padding: .85rem 1.1rem; font-weight: 800; }
.primary-button { color: var(--navy); background: linear-gradient(135deg, var(--gold), #f4d78f); }
.primary-button:disabled { opacity: .6; cursor: wait; }
.primary-button.compact { padding: .7rem .9rem; }
.secondary-button { color: var(--navy); background: #e7eef1; }
.danger-button { color: white; background: var(--danger); }
.login-card .primary-button { width: 100%; margin-top: 1rem; }
.security-note { display: block; margin-top: 1.25rem; color: #a9bbc4; text-align: center; }
.form-message { min-height: 1.2rem; margin: .7rem 0 0; font-size: .84rem; }
.error-message { color: #ff9898; }

.panel-shell { min-height: 100svh; position: relative; }
.captain-background { z-index: -2; background: linear-gradient(rgba(233,241,244,.91), rgba(233,241,244,.96)), url("assets/captain-huseyin.jpg") center / cover no-repeat; }
.sidebar { position: fixed; z-index: 10; inset: 0 auto 0 0; width: 255px; padding: 1.4rem; display: flex; flex-direction: column; color: white; background: rgba(3, 17, 29, .97); box-shadow: 8px 0 35px rgba(0,0,0,.18); }
.sidebar nav { display: grid; gap: .4rem; margin-top: 2.5rem; }
.nav-button { border: 0; border-radius: 11px; padding: .85rem 1rem; color: #b8c9d1; text-align: left; background: transparent; }
.nav-button:hover, .nav-button.active { color: white; background: linear-gradient(90deg, rgba(25,198,200,.24), rgba(25,198,200,.06)); }
.sidebar-user { display: flex; align-items: center; gap: .75rem; margin-top: auto; padding: 1rem 0; border-top: 1px solid rgba(255,255,255,.11); }
.sidebar-user img { width: 45px; height: 45px; border-radius: 50%; object-fit: cover; object-position: 65% center; }
.sidebar-user span { display: grid; }
.sidebar-user small { color: #92a6b0; }
.logout-button { color: #ffc6c6; background: rgba(198,79,79,.15); }
.site-link { margin-top: .9rem; color: #90aab5; font-size: .82rem; text-align: center; }
.panel-main { min-height: 100svh; margin-left: 255px; padding: 2rem clamp(1rem, 3vw, 3.5rem) 4rem; }
.panel-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; }
.panel-header .eyebrow, .card-heading .eyebrow { margin: 0 0 .35rem; }
.panel-header h1, .card-heading h2 { margin: 0; }
.sync-state { padding: .55rem .8rem; border-radius: 999px; color: #16766d; font-size: .8rem; font-weight: 800; background: #d9f3ee; }
.sync-state.error { color: #8b3030; background: #f8dddd; }
.sidebar-toggle { display: none; border: 0; padding: .5rem; font-size: 1.4rem; background: transparent; }
.panel-view { display: none; }
.panel-view.active { display: block; }
.summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
.summary-grid article, .content-card { border: 1px solid rgba(8,37,58,.08); border-radius: 18px; background: rgba(255,255,255,.93); box-shadow: 0 12px 35px rgba(5,36,54,.07); }
.summary-grid article { padding: 1.2rem; }
.summary-grid span { display: block; color: var(--muted); font-size: .82rem; }
.summary-grid strong { display: block; margin-top: .35rem; font-size: clamp(1.7rem, 4vw, 2.5rem); }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(300px, .8fr); gap: 1rem; margin-top: 1rem; }
.content-card { padding: 1.35rem; }
.card-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.calendar-controls { display: flex; gap: .35rem; }
.calendar-controls button { width: 36px; height: 36px; border: 1px solid #d7e0e4; border-radius: 9px; background: white; }
.calendar-weekdays, .calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: .3rem; }
.calendar-weekdays span { padding: .4rem 0; color: var(--muted); font-size: .72rem; text-align: center; }
.calendar-day { min-height: 58px; border: 1px solid transparent; border-radius: 10px; padding: .45rem; color: var(--navy); text-align: left; background: #f5f8f9; }
.calendar-day.outside { opacity: .3; }
.calendar-day.has-record { border-color: rgba(8,123,165,.25); }
.calendar-day span { display: block; }
.calendar-day i { display: inline-block; width: 8px; height: 8px; margin-top: .35rem; border-radius: 50%; }
.planned { background: #e6b75b; }.completed { background: #19a77f; }.cancelled { background: #c64f4f; }
.calendar-legend { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 1rem; color: var(--muted); font-size: .75rem; }
.calendar-legend span { display: flex; align-items: center; gap: .35rem; }
.calendar-legend i { width: 8px; height: 8px; border-radius: 50%; }
.record-list { display: grid; gap: .7rem; }
.record-item { width: 100%; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: .8rem; border: 1px solid #e2e9ec; border-radius: 12px; padding: .8rem; color: var(--navy); text-align: left; background: white; }
.record-date { display: grid; place-items: center; min-width: 50px; padding: .45rem; border-radius: 10px; color: white; background: var(--navy-soft); }
.record-date strong { font-size: 1.2rem; }.record-date small { text-transform: uppercase; }
.record-copy { display: grid; }.record-copy small { color: var(--muted); }
.status-chip { border-radius: 999px; padding: .35rem .55rem; font-size: .7rem; font-weight: 800; }
.status-chip.planned { color: #765514; background: #fff1c8; }.status-chip.completed { color: #0b6650; background: #d9f3eb; }.status-chip.cancelled { color: #8b3030; background: #f8dddd; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .85rem .65rem; border-bottom: 1px solid #e6ecef; text-align: left; white-space: nowrap; }
th { color: var(--muted); font-size: .73rem; text-transform: uppercase; }
.row-actions { display: flex; gap: .35rem; justify-content: flex-end; }
.icon-button { border: 0; border-radius: 8px; padding: .45rem .6rem; background: #e7eef1; }
.icon-button.delete { color: var(--danger); background: #fae5e5; }
.empty-state { padding: 2rem; color: var(--muted); text-align: center; }
.form-card { max-width: 1050px; }
.form-grid { display: grid; gap: 1rem; margin-bottom: 1rem; }
.three-columns { grid-template-columns: repeat(3, 1fr); }.two-columns { grid-template-columns: repeat(2, 1fr); }.four-columns { grid-template-columns: repeat(4, 1fr); }
fieldset { margin: 1.25rem 0; border: 1px solid #dce5e9; border-radius: 16px; padding: 1rem; }
legend { padding: 0 .5rem; font-weight: 900; }
.fish-grid { display: grid; gap: .7rem; }
.fish-row { display: grid; grid-template-columns: minmax(100px, 1fr) repeat(2, minmax(120px, .6fr)); align-items: end; gap: .8rem; padding: .8rem; border-radius: 12px; background: #f3f7f8; }
.fish-row label { font-size: .75rem; }
.form-actions { display: flex; justify-content: flex-end; gap: .7rem; margin-top: 1rem; }
.toast { position: fixed; z-index: 100; right: 1rem; bottom: 1rem; max-width: 340px; border-radius: 12px; padding: .9rem 1rem; color: white; background: var(--navy); box-shadow: var(--shadow); opacity: 0; transform: translateY(15px); pointer-events: none; transition: .2s; }
.toast.show { opacity: 1; transform: translateY(0); }
dialog { border: 0; border-radius: 18px; padding: 0; box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(0,10,18,.64); }
.confirm-card { min-width: min(380px, 90vw); padding: 1.5rem; }
.confirm-card div { display: flex; justify-content: flex-end; gap: .6rem; }

@media (max-width: 1050px) {
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .four-columns { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 760px) {
  .sidebar { transform: translateX(-105%); transition: transform .25s; }
  .sidebar.open { transform: translateX(0); }
  .panel-main { margin-left: 0; padding: 1rem 1rem 3rem; }
  .sidebar-toggle { display: block; }
  .panel-header { justify-content: flex-start; gap: .7rem; }
  .panel-header .sync-state { margin-left: auto; }
  .three-columns, .two-columns, .four-columns { grid-template-columns: 1fr; }
  .fish-row { grid-template-columns: 1fr 1fr; }
  .fish-row strong { grid-column: 1 / -1; }
}

@media (max-width: 480px) {
  .login-card { padding: 1.4rem; }
  .summary-grid { grid-template-columns: 1fr 1fr; gap: .6rem; }
  .summary-grid article { padding: .9rem; }
  .calendar-day { min-height: 45px; padding: .3rem; font-size: .76rem; }
  .record-item { grid-template-columns: auto 1fr; }
  .record-item .status-chip { grid-column: 2; justify-self: start; }
  .panel-header h1 { font-size: 1.35rem; }
}
