:root{
  --bg: #0a0e1a;
  --panel: #131829;
  --card: #1a2235;
  --line: rgba(124,92,255,.15);
  --fg: #e8f0ff;
  --muted: rgba(232,240,255,.75);
  --accent: #8b6bff;
  --accent2: #2de2e6;
  --danger: #ff4d6d;
  --success: #00d9a6;

  --radius: 16px;
  --shadow: 0 18px 50px rgba(0,0,0,.45);
}

html[data-theme="light"]{
  --bg: #f6f7fb;
  --panel: #ffffff;
  --card: #ffffff;
  --line: rgba(10,12,18,.10);
  --fg: #0a0c12;
  --muted: rgba(10,12,18,.65);
  --accent: #5b3dff;
  --accent2: #00b7c7;
  --shadow: 0 18px 50px rgba(20,22,30,.12);
  --danger: #ff4d6d;
}

html[data-theme="light"] .library-card,
html[data-theme="light"] .modern-card{
  background: linear-gradient(180deg, rgba(255,255,255,.95), rgba(250,250,255,.95));
  border:1px solid rgba(91,61,255,.15);
}

html[data-theme="light"] .library-icon,
html[data-theme="light"] .list-item-icon{
  background: linear-gradient(135deg, rgba(91,61,255,.15), rgba(0,183,199,.15));
  border:1px solid rgba(91,61,255,.2);
}

html[data-theme="light"] .role-owner{
  background: rgba(91,61,255,.15);
  border:1px solid rgba(91,61,255,.4);
  color: #5b3dff;
}

html[data-theme="light"] .role-editor{
  background: rgba(0,183,199,.15);
  border:1px solid rgba(0,183,199,.4);
  color: #00b7c7;
}

html[data-theme="light"] .role-viewer{
  background: rgba(10,12,18,.08);
  border:1px solid rgba(10,12,18,.15);
  color: rgba(10,12,18,.65);
}

html[data-theme="light"] .modern-list-item{
  background: rgba(91,61,255,.05);
  border:1px solid rgba(10,12,18,.12);
}

html[data-theme="light"] .modern-list-item:hover{
  background: rgba(91,61,255,.1);
  border-color: rgba(91,61,255,.3);
}

html[data-theme="light"] .sidebar{
  background: rgba(255,255,255,.95);
  border-right:1px solid rgba(10,12,18,.12);
}

html[data-theme="light"] .sidebar-item{
  background: rgba(91,61,255,.05);
  border:1px solid rgba(10,12,18,.12);
}

html[data-theme="light"] .sidebar-item.active{
  border-color: rgba(91,61,255,.5);
  box-shadow: 0 0 0 3px rgba(91,61,255,.1);
  background: rgba(91,61,255,.1);
}

@import url('https://fonts.googleapis.com/css2?family=Crimson+Text:ital@0;1&family=Playfair+Display:wght@400;700;800&display=swap');

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  background: radial-gradient(1200px 700px at 20% -10%, rgba(124,92,255,.22), transparent 55%),
              radial-gradient(900px 600px at 90% 0%, rgba(45,226,230,.18), transparent 50%),
              var(--bg);
  color:var(--fg);
  font: 14px/1.45 ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial;
}

a{color:inherit; text-decoration:none}
.row{display:flex; gap:10px; align-items:center}
.row-between{display:flex; gap:12px; align-items:flex-start; justify-content:space-between}
.wrap{flex-wrap:wrap}
.grow{flex:1}
.right{text-align:right}

.app-shell{
  min-height:100vh;
  display:grid;
  grid-template-columns: 280px 1fr;
  background:var(--bg);
}

.sidebar{
  background: rgba(16,21,34,.65);
  border-right:1px solid var(--line);
  backdrop-filter: blur(10px);
  padding:14px;
  display:flex;
  flex-direction:column;
  gap:14px;
}

.sidebar-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
}
.brand{font-weight:700; letter-spacing:.2px}
.sidebar-label{color:var(--muted); font-size:12px; text-transform:uppercase; letter-spacing:.12em}
.sidebar-list{display:flex; flex-direction:column; gap:8px}
.sidebar-item{
  border:1px solid var(--line);
  background: rgba(15,22,38,.55);
  border-radius:14px;
  padding:10px 10px;
}
.sidebar-item.active{
  border-color: rgba(124,92,255,.55);
  box-shadow: 0 0 0 3px rgba(124,92,255,.14);
}
.sidebar-item-title{font-weight:650}
.sidebar-item-meta{color:var(--muted); font-size:12px}
.sidebar-footer{margin-top:auto; display:flex; flex-direction:column; gap:8px}

.main{padding:18px; background:var(--bg)}

.center{
  min-height:calc(100vh - 36px);
  display:flex;
  align-items:center;
  justify-content:center;
}

.page{max-width: 1100px; margin: 0 auto}
.page-header{
  margin: 10px 0 14px;
  padding: 16px;
  background: linear-gradient(135deg, rgba(139,107,255,.1), rgba(45,226,230,.05));
  border: 1px solid rgba(139,107,255,.2);
  border-radius: var(--radius);
}
.h1{font-size:22px; font-weight:780}
.h2{font-size:16px; font-weight:600}
.muted{color:var(--muted)}
.p{color:var(--muted); margin: 8px 0 0}

.card{
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.02));
  border:1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow:hidden;
}
.card-header{
  padding:14px 14px 0;
  background: linear-gradient(135deg, rgba(139,107,255,.08), rgba(45,226,230,.05));
  border-bottom: 1px solid rgba(139,107,255,.15);
  margin: -1px -1px 0 -1px;
  border-radius: var(--radius) var(--radius) 0 0;
}
.card-body{padding:14px}

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

.list{display:flex; flex-direction:column; gap:10px}
.list-item{
  border:1px solid var(--line);
  background: rgba(15,22,38,.35);
  border-radius:14px;
  padding:10px;
  display:flex;
  justify-content:space-between;
  align-items:center;
}
.list-item-title{font-weight:700}
.list-item-meta{color:var(--muted); font-size:12px}

.form .label{display:block; margin:10px 0 6px; color:var(--muted)}
.input{
  width:100%;
  background: rgba(15,22,38,.35);
  border:1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  color:var(--fg);
  outline:none;
}
.input:focus{
  border-color: rgba(124,92,255,.55);
  box-shadow: 0 0 0 3px rgba(124,92,255,.14);
}
.input.small{width: 220px}
.textarea{resize:vertical}

.btn{
  border:1px solid rgba(139,107,255,.6);
  background: linear-gradient(135deg, rgba(139,107,255,.25), rgba(45,226,230,.15));
  color: var(--fg);
  border-radius: 14px;
  padding: 10px 12px;
  font-weight:700;
  cursor:pointer;
  transition: all 0.2s;
}
.btn.disabled, .btn[aria-disabled="true"]{
  opacity:.55;
  pointer-events:none;
  filter: grayscale(60%);
}
.btn:hover{
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(139,107,255,.3);
}
.btn:active{transform: translateY(1px)}
.btn-ghost{
  border:1px solid rgba(139,107,255,.3);
  background: rgba(26,34,53,.6);
}
.btn-ghost:hover{
  background: rgba(139,107,255,.15);
  border-color: rgba(139,107,255,.5);
}
.icon-btn{
  border:1px solid var(--line);
  background: rgba(15,22,38,.35);
  border-radius: 12px;
  padding: 8px 10px;
  cursor:pointer;
  color:var(--fg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.pill{
  border:1px solid var(--line);
  background: rgba(15,22,38,.25);
  border-radius: 999px;
  padding: 6px 10px;
  color: var(--muted);
}

.tag{
  border:1px solid var(--line);
  background: rgba(15,22,38,.30);
  border-radius: 999px;
  padding: 4px 9px;
  font-size:12px;
}

.kindle-grid{
  margin-top: 20px;
  display:grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
  padding: 4px;
}

.kindle-card{
  border:1px solid rgba(139,107,255,.25);
  background: var(--card);
  border-radius: 16px;
  overflow: hidden;
  display:flex;
  flex-direction:column;
  transition: all 0.3s ease;
  position: relative;
  box-shadow: 0 4px 12px rgba(0,0,0,.2);
}

.kindle-card:hover{
  transform: translateY(-6px);
  box-shadow: 0 12px 32px rgba(139,107,255,.3);
  border-color: var(--accent);
}

.kindle-cover{
  width: 100%;
  height: 160px;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(139,107,255,.15), rgba(45,226,230,.1));
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.kindle-cover::before{
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 0%, rgba(0,0,0,.3) 100%);
  z-index: 1;
}

.kindle-cover img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: relative;
  z-index: 0;
}

.kindle-content{
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  background: linear-gradient(180deg, rgba(139,107,255,.03), transparent);
}

.kindle-title{
  font-weight: 800;
  letter-spacing: .3px;
  font-size: 15px;
  line-height: 1.3;
  color: var(--fg);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.kindle-title-row{
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.kindle-info-small{
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  opacity: 0.7;
  font-weight: 600;
}

.kindle-sub{
  color: var(--muted);
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
}

.kindle-sub i{
  font-size: 10px;
  opacity: 0.7;
  color: var(--accent);
}

.kindle-isbn{
  color: var(--muted);
  font-size: 11px;
  font-family: 'Courier New', monospace;
  display: flex;
  align-items: center;
  gap: 6px;
}

.kindle-meta{
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.kindle-footer{
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.kindle-value{
  font-weight: 600;
  font-size: 13px;
  color: var(--accent2);
  display: flex;
  align-items: center;
  gap: 4px;
}

.tag-okay{
  background: rgba(255,183,77,.2);
  color: #FFB74D;
}

.tag-good{
  background: rgba(129,212,250,.2);
  color: #81D4FA;
}

.tag-excellent{
  background: rgba(102,187,106,.2);
  color: #66BB6A;
}

.tag-like_new{
  background: rgba(171,71,188,.2);
  color: #AB47BC;
}

.tag-qty{
  background: rgba(255,255,255,.1);
  font-weight: 700;
}

.isbn-input-group{
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.isbn-input-group .input{
  flex: 1;
}

.isbn-input-group .btn{
  white-space: nowrap;
}

.grid2{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 20px;
}

@media (max-width: 980px){
  .grid2{
    grid-template-columns: 1fr;
  }
}

.kindle-title{font-weight:800; letter-spacing:.2px}
.kindle-sub{color:var(--muted)}
.kindle-meta{display:flex; gap:8px; flex-wrap:wrap}
.kindle-footer{margin-top:auto}

.table-wrap{overflow:auto}
.table{
  width:100%;
  border-collapse: collapse;
  min-width: 860px;
}
.table th, .table td{
  border-bottom: 1px solid var(--line);
  padding: 10px 10px;
  vertical-align:top;
}
.table th{color:var(--muted); font-weight:700; text-align:left}

.error{
  margin-top: 10px;
  color: var(--danger);
}

.landing-container{
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-x: hidden;
  background: radial-gradient(1200px 700px at 20% -10%, rgba(124,92,255,.22), transparent 55%),
              radial-gradient(900px 600px at 90% 0%, rgba(45,226,230,.18), transparent 50%),
              var(--bg);
}

.login-card{
  width: 100%;
  max-width: 520px;
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.02));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  padding: 40px;
}

.login-header{
  text-align: center;
  margin-bottom: 40px;
}

.login-title{
  font-family: 'Playfair Display', serif;
  font-size: clamp(32px, 8vw, 48px);
  font-weight: 400;
  margin: 0 0 2px 0;
  letter-spacing: 2px;
  color: var(--fg);
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.login-tagline{
  font-size: 14px;
  color: var(--muted);
  margin: 0;
  font-weight: 400;
}

.login-body{
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.btn-signin{
  padding: 12px 20px !important;
  font-size: 15px !important;
  font-weight: 700 !important;
  border-radius: 12px !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100% !important;
}

.btn-signin span{
  font-size: 18px;
}

.library-grid{
  display:grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap:16px;
  margin-top:20px;
}

.library-card{
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.02));
  border:1px solid var(--line);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  padding:20px;
  display:flex;
  flex-direction:column;
  gap:16px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.library-card:hover{
  transform: translateY(-2px);
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
}

.library-card-header{
  display:flex;
  gap:14px;
  align-items:flex-start;
}

.library-icon{
  width:48px;
  height:48px;
  border-radius:12px;
  background: linear-gradient(135deg, rgba(124,92,255,.25), rgba(45,226,230,.25));
  border:1px solid var(--line);
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:22px;
  flex-shrink:0;
}

.library-card-title{
  font-size:18px;
  font-weight:700;
  margin-bottom:4px;
}

.library-card-desc{
  font-size:13px;
  color:var(--muted);
  line-height:1.4;
}

.library-card-stats{
  display:flex;
  gap:12px;
  padding:12px 0;
  border-top:1px solid var(--line);
  border-bottom:1px solid var(--line);
}

.stat-item{
  flex:1;
  text-align:center;
}

.stat-value{
  font-size:24px;
  font-weight:800;
  color:var(--accent);
  margin-bottom:4px;
}

.stat-label{
  font-size:11px;
  text-transform:uppercase;
  letter-spacing:.08em;
  color:var(--muted);
  font-weight:600;
}

.stat-badge{
  padding:6px 12px;
  border-radius:999px;
  font-size:11px;
  font-weight:700;
  text-transform:uppercase;
  letter-spacing:.06em;
}

.role-owner{
  background: rgba(124,92,255,.2);
  border:1px solid rgba(124,92,255,.5);
  color:var(--accent);
}

.role-editor{
  background: rgba(45,226,230,.2);
  border:1px solid rgba(45,226,230,.5);
  color:var(--accent2);
}

.role-viewer{
  background: rgba(255,255,255,.08);
  border:1px solid var(--line);
  color:var(--muted);
}

.library-card-footer{
  margin-top:auto;
}

.btn-library-open{
  width:100%;
  justify-content:center;
  display:flex;
  align-items:center;
  gap:8px;
}

.flex-1{flex:1}

.modern-card{
  position:relative;
  overflow:visible;
  background: linear-gradient(135deg, var(--card), rgba(139,107,255,.05));
  border: 1px solid rgba(139,107,255,.2);
}

.modern-card::before{
  content:'';
  position:absolute;
  top:-1px;
  left:-1px;
  right:-1px;
  bottom:-1px;
  background: linear-gradient(135deg, rgba(139,107,255,.4), rgba(45,226,230,.4));
  border-radius:var(--radius);
  opacity:0;
  transition:opacity 0.3s ease;
  z-index:-1;
}

.modern-card:hover::before{
  opacity:0.25;
}

.modern-list-item{
  display:flex;
  align-items:center;
  gap:12px;
  padding:12px;
  border:1px solid var(--line);
  background:rgba(15,22,38,.35);
  border-radius:12px;
  transition: all 0.2s ease;
}

.modern-list-item:hover{
  background:rgba(15,22,38,.55);
  border-color:rgba(124,92,255,.4);
  transform:translateX(4px);
}

.list-item-icon{
  width:40px;
  height:40px;
  border-radius:10px;
  background:linear-gradient(135deg, rgba(124,92,255,.2), rgba(45,226,230,.2));
  border:1px solid var(--line);
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:18px;
  flex-shrink:0;
}

.role-badge-small{
  padding:4px 10px;
  border-radius:999px;
  font-size:10px;
  font-weight:700;
  text-transform:uppercase;
  letter-spacing:.06em;
}

.empty-state{
  text-align:center;
  padding:40px 20px;
  color:var(--muted);
}

.empty-state i{
  font-size:48px;
  margin-bottom:12px;
  opacity:0.3;
  display:block;
}

.btn-create{
  background:linear-gradient(135deg, rgba(124,92,255,.25), rgba(45,226,230,.25));
  border-color:rgba(124,92,255,.6);
}

.btn-create:hover{
  background:linear-gradient(135deg, rgba(124,92,255,.35), rgba(45,226,230,.35));
}

.modern-form{
  max-width:800px;
  margin:0 auto;
}

.form-grid{
  display:grid;
  gap:20px;
}

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

.form-group:last-child{
  margin-bottom:0;
}

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

.form-actions{
  display:flex;
  gap:12px;
  justify-content:center;
  margin-top:24px;
  padding-top:24px;
  border-top:1px solid var(--line);
}

.btn-lg{
  padding:12px 24px;
  font-size:15px;
}

.btn-primary{
  background:linear-gradient(135deg, var(--accent), var(--accent2));
  border:none;
  box-shadow:0 4px 14px rgba(124,92,255,.4);
}

.btn-primary:hover{
  box-shadow:0 6px 20px rgba(124,92,255,.6);
  transform:translateY(-2px);
}

.label i{
  margin-right:6px;
  opacity:0.7;
}

/* Excel-like Spreadsheet Styles */
.sheet-page{
  max-width:100%;
  padding:0;
}

.sheet-header{
  background:var(--panel);
  border-bottom:2px solid var(--line);
  padding:16px 20px;
  margin-bottom:0;
}

.sheet-header-content{
  display:flex;
  justify-content:space-between;
  align-items:center;
  flex-wrap:wrap;
  gap:12px;
}

.sheet-actions{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}

.excel-toolbar{
  background:var(--panel);
  border-bottom:1px solid var(--line);
  padding:12px 20px;
}

.excel-filters{
  display:flex;
  gap:12px;
  flex-wrap:wrap;
  align-items:end;
}

.filter-group{
  display:flex;
  flex-direction:column;
  gap:4px;
  flex:1;
  min-width:180px;
}

.filter-label{
  font-size:11px;
  font-weight:600;
  text-transform:uppercase;
  letter-spacing:.05em;
  color:var(--muted);
}

.excel-input{
  background:var(--bg);
  border:1px solid var(--line);
  border-radius:6px;
  padding:8px 10px;
  color:var(--fg);
  font-size:13px;
  transition:all 0.2s ease;
}

.excel-input:focus{
  border-color:var(--accent);
  outline:none;
  box-shadow:0 0 0 3px rgba(124,92,255,.1);
}

.excel-container{
  overflow:auto;
  max-height:calc(100vh - 240px);
  background:var(--bg);
}

.excel-wrapper{
  min-width:100%;
  overflow-x:auto;
}

.excel-table{
  width:100%;
  border-collapse:separate;
  border-spacing:0;
  font-size:13px;
  background:var(--panel);
}

.excel-th{
  position:sticky;
  top:0;
  background:linear-gradient(180deg, rgba(124,92,255,.15), rgba(124,92,255,.08));
  border-right:1px solid var(--line);
  border-bottom:2px solid var(--accent);
  padding:10px 12px;
  text-align:left;
  font-weight:700;
  font-size:12px;
  text-transform:uppercase;
  letter-spacing:.06em;
  color:var(--fg);
  white-space:nowrap;
  z-index:10;
  cursor:pointer;
  user-select:none;
}

.excel-th:last-child{
  border-right:none;
}

.excel-th-content{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
}

.excel-th-content i{
  opacity:0.4;
  font-size:10px;
}

.excel-th:hover{
  background:linear-gradient(180deg, rgba(124,92,255,.25), rgba(124,92,255,.15));
}

.excel-th:hover .excel-th-content i{
  opacity:1;
}

.excel-th-number{
  text-align:right;
}

.excel-th-actions{
  text-align:center;
  cursor:default;
}

.excel-th-actions:hover{
  background:linear-gradient(180deg, rgba(124,92,255,.15), rgba(124,92,255,.08));
}

.excel-row{
  transition:background 0.15s ease;
}

.excel-row:nth-child(even){
  background:rgba(255,255,255,.02);
}

.excel-row:hover{
  background:rgba(124,92,255,.08);
}

.excel-td{
  border-right:1px solid var(--line);
  border-bottom:1px solid var(--line);
  padding:10px 12px;
  color:var(--fg);
}

.excel-td:last-child{
  border-right:none;
}

.excel-td-primary{
  font-weight:600;
}

.excel-td-center{
  text-align:center;
}

.excel-td-number{
  text-align:right;
  font-variant-numeric:tabular-nums;
}

.excel-td-actions{
  text-align:center;
}

.excel-badge{
  display:inline-block;
  padding:4px 10px;
  border-radius:4px;
  font-size:10px;
  font-weight:700;
  text-transform:uppercase;
  letter-spacing:.08em;
}

.excel-badge-okay{
  background:rgba(255,193,7,.2);
  color:#ffc107;
  border:1px solid rgba(255,193,7,.4);
}

.excel-badge-good{
  background:rgba(76,175,80,.2);
  color:#4caf50;
  border:1px solid rgba(76,175,80,.4);
}

.excel-badge-excellent{
  background:rgba(33,150,243,.2);
  color:#2196f3;
  border:1px solid rgba(33,150,243,.4);
}

.excel-badge-like_new{
  background:rgba(124,92,255,.2);
  color:var(--accent);
  border:1px solid rgba(124,92,255,.4);
}

.excel-value{
  color:#4caf50;
  font-weight:600;
}

.excel-empty{
  color:var(--muted);
  opacity:0.5;
}

.excel-btn{
  background:transparent;
  border:1px solid var(--line);
  border-radius:6px;
  padding:6px 10px;
  color:var(--fg);
  cursor:pointer;
  transition:all 0.2s ease;
  font-size:13px;
}

.excel-btn:hover{
  background:rgba(124,92,255,.15);
  border-color:var(--accent);
  color:var(--accent);
}

.sidebar-toggle{
  display:none;
  position:fixed;
  top:16px;
  left:16px;
  z-index:1000;
  background:var(--panel);
  border:1px solid var(--line);
  border-radius:10px;
  padding:10px 16px;
  cursor:pointer;
  color:var(--fg);
  font-weight:700;
  font-size:14px;
  box-shadow:0 4px 12px rgba(0,0,0,.3);
  transition:all 0.2s ease;
}

.sidebar-toggle:hover{
  background:var(--accent);
  border-color:var(--accent);
  transform:scale(1.05);
}

.sidebar-toggle i{
  margin-right:6px;
}

/* Item View Page */
.item-view-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:20px;
  margin-top:20px;
}

.item-details-card{
  height:fit-content;
}

.detail-row{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  padding:12px 0;
  border-bottom:1px solid var(--line);
  gap:16px;
}

.detail-row:last-child{
  border-bottom:none;
}

.detail-row-notes{
  flex-direction:column;
  align-items:flex-start;
}

.detail-label{
  font-size:12px;
  font-weight:600;
  color:var(--muted);
  text-transform:uppercase;
  letter-spacing:.06em;
  min-width:140px;
}

.detail-label i{
  margin-right:6px;
  opacity:0.7;
}

.detail-value{
  font-size:15px;
  font-weight:500;
  color:var(--fg);
  text-align:right;
  flex:1;
}

.detail-notes{
  text-align:left;
  margin-top:8px;
  line-height:1.6;
  color:var(--muted);
  background:rgba(255,255,255,.03);
  padding:12px;
  border-radius:8px;
  width:100%;
}

/* AI Chat Interface */
.ai-chat-container{
  display:flex;
  flex-direction:column;
  height:500px;
}

.ai-chat-messages{
  flex:1;
  overflow-y:auto;
  padding:16px;
  display:flex;
  flex-direction:column;
  gap:16px;
  background:rgba(0,0,0,.15);
  border-radius:12px;
  margin-bottom:16px;
}

.ai-message{
  display:flex;
  gap:12px;
  animation:slideIn 0.3s ease;
}

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

.ai-message-user{
  flex-direction:row-reverse;
  justify-content:flex-start;
}

.ai-message-icon{
  width:36px;
  height:36px;
  border-radius:50%;
  background:linear-gradient(135deg, var(--accent), var(--accent2));
  display:flex;
  align-items:center;
  justify-content:center;
  flex-shrink:0;
  font-size:18px;
}

.ai-message-content{
  background:rgba(255,255,255,.08);
  border:1px solid var(--line);
  border-radius:12px;
  padding:12px 16px;
  max-width:80%;
  line-height:1.6;
}

.ai-message-user .ai-message-content{
  background:linear-gradient(135deg, rgba(124,92,255,.25), rgba(45,226,230,.25));
  border-color:rgba(124,92,255,.4);
  text-align:right;
}

.ai-chat-input-form{
  display:flex;
  gap:10px;
}

.ai-chat-input{
  flex:1;
  background:var(--bg);
  border:1px solid var(--line);
  border-radius:10px;
  padding:12px 16px;
  color:var(--fg);
  font-size:14px;
  transition:all 0.2s ease;
}

.ai-chat-input:focus{
  border-color:var(--accent);
  outline:none;
  box-shadow:0 0 0 3px rgba(124,92,255,.15);
}

.ai-chat-submit{
  background:linear-gradient(135deg, var(--accent), var(--accent2));
  border:none;
  border-radius:10px;
  padding:12px 20px;
  color:var(--fg);
  cursor:pointer;
  transition:all 0.2s ease;
  font-size:16px;
}

.ai-chat-submit:hover{
  transform:scale(1.05);
  box-shadow:0 4px 12px rgba(124,92,255,.4);
}

.ai-chat-submit:disabled{
  opacity:0.5;
  cursor:not-allowed;
  transform:none;
}

/* Floating Chat Button */
.floating-chat-btn{
  position:fixed;
  bottom:30px;
  right:30px;
  width:60px;
  height:60px;
  border-radius:50%;
  background:linear-gradient(135deg, var(--accent), var(--accent2));
  border:none;
  color:var(--fg);
  font-size:24px;
  cursor:pointer;
  box-shadow:0 4px 20px rgba(124,92,255,.5);
  transition:all 0.3s ease;
  z-index:999;
  display:flex;
  align-items:center;
  justify-content:center;
}

.floating-chat-btn:hover{
  transform:scale(1.1);
  box-shadow:0 6px 28px rgba(124,92,255,.7);
}

.floating-chat-btn:active{
  transform:scale(0.95);
}

/* Chat Modal */
.chat-modal{
  position:fixed;
  top:0;
  left:0;
  width:100%;
  height:100%;
  background:rgba(0,0,0,.7);
  z-index:1000;
  display:none;
  align-items:center;
  justify-content:center;
  backdrop-filter:blur(4px);
}

.chat-modal.show{
  display:flex;
}

.chat-modal-content{
  background:var(--panel);
  border:1px solid var(--line);
  border-radius:16px;
  width:90%;
  max-width:600px;
  max-height:80vh;
  display:flex;
  flex-direction:column;
  box-shadow:0 20px 60px rgba(0,0,0,.5);
  animation:slideUp 0.3s ease;
}

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

.chat-modal-header{
  padding:20px 24px;
  border-bottom:1px solid var(--line);
  display:flex;
  justify-content:space-between;
  align-items:center;
  background:linear-gradient(180deg, rgba(124,92,255,.1), transparent);
}

.chat-modal-title{
  font-size:18px;
  font-weight:700;
  display:flex;
  align-items:center;
  gap:10px;
  color:var(--fg);
}

.chat-modal-title i{
  color:var(--accent);
}

.chat-modal-close{
  background:rgba(255,255,255,.05);
  border:1px solid var(--line);
  border-radius:8px;
  width:36px;
  height:36px;
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  transition:all 0.2s ease;
  color:var(--muted);
}

.chat-modal-close:hover{
  background:rgba(255,255,255,.1);
  color:var(--fg);
}

.chat-modal-body{
  flex:1;
  overflow-y:auto;
  padding:20px;
  min-height:400px;
  max-height:calc(80vh - 180px);
}

.chat-modal-footer{
  padding:20px 24px;
  border-top:1px solid var(--line);
  background:rgba(0,0,0,.2);
}

/* Item View Layout */
.item-view-container{
  margin-top:20px;
  display:grid;
  grid-template-columns:300px 1fr;
  gap:20px;
}

.item-cover-section{
  position:sticky;
  top:20px;
  height:fit-content;
}

.item-cover-image{
  width:100%;
  border-radius:12px;
  box-shadow:0 8px 24px rgba(0,0,0,.4);
  border:1px solid var(--line);
}

.item-details-section{
  min-height:400px;
}

@media (max-width: 980px){
  .item-view-container{
    grid-template-columns:1fr;
  }
  
  .item-cover-section{
    position:relative;
    top:0;
  }
  
  .item-cover-image{
    max-width:300px;
    margin:0 auto;
    display:block;
  }
  
  .floating-chat-btn{
    bottom:20px;
    right:20px;
    width:56px;
    height:56px;
    font-size:22px;
  }
  
  .chat-modal-content{
    width:95%;
    max-height:90vh;
  }
}

.kindle-card-link{
  display:flex;
  flex-direction:column;
  text-decoration:none;
  color:inherit;
  transition:all 0.2s ease;
}

.kindle-card-link:hover{
  transform:translateY(-4px);
  box-shadow:0 8px 24px rgba(0,0,0,.4);
}

.btn-sm{
  padding:6px 10px;
  font-size:12px;
}

@media (max-width: 980px){
  .app-shell{grid-template-columns: 1fr}
  .sidebar{
    position:fixed;
    left:0;
    top:0;
    height:100vh;
    width:280px;
    z-index:100;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    box-shadow:4px 0 12px rgba(0,0,0,.5);
  }
  .sidebar.open{
    transform: translateX(0);
  }
  .sidebar-toggle{display:flex; align-items:center}
  .main{padding-left:14px; padding-right:14px; padding-top:80px}
  .kindle-grid{grid-template-columns: repeat(2, minmax(0, 1fr))}
  .grid2{grid-template-columns: 1fr}
  .library-grid{grid-template-columns: 1fr}
  .item-view-grid{grid-template-columns: 1fr}
  .ai-message-content{max-width: 90%}
  .input.small{width: 100%}
  .page-header{margin-bottom:10px}
  .row-between{gap:10px}
  
  .excel-toolbar{padding:12px 16px}
  .excel-filters{gap:10px}
  .filter-group{min-width:140px}
  .sheet-header{padding:14px 16px}
  .excel-container{max-height:calc(100vh - 280px)}
  .excel-table{font-size:12px}
  .excel-th, .excel-td{padding:8px 10px}
}

@media (max-width: 640px){
  body{font-size:13px}
  .sidebar-header{flex-direction:column; gap:8px; align-items:flex-start}
  .sidebar{width:260px}
  .app-shell{min-height:100vh}
  .main{padding:12px 10px}
  .h1{font-size:18px}
  .h2{font-size:14px}
  .kindle-grid{grid-template-columns: 1fr; gap:10px}
  .kindle-card{min-height:120px; padding:10px}
  .card{border-radius:12px}
  .btn, .input{padding:9px 10px; font-size:13px; border-radius:10px}
  .row-between{flex-direction:column; align-items:flex-start; gap:8px}
  .row{flex-wrap:wrap; gap:6px}
  .table-wrap{border-radius:12px; overflow-x:auto}
  .table{min-width:100%; font-size:12px}
  .table th, .table td{padding:8px}
  
  .login-card{padding:30px 20px; max-width:100%}
  .login-title{font-size:36px; letter-spacing:1px}
  .login-tagline{font-size:13px}
  .login-header{margin-bottom:30px}
  .btn-signin{padding:11px 16px !important; font-size:14px !important}
  .btn-signin span{font-size:16px}
  
  .library-grid{grid-template-columns: 1fr; gap:12px}
  .library-card{padding:16px}
  .library-icon{width:40px; height:40px; font-size:18px}
  .library-card-title{font-size:16px}
  .stat-value{font-size:20px}
  
  .form-row{grid-template-columns:1fr}
  .form-actions{flex-direction:column}
  .form-actions .btn{width:100%}
  .modern-list-item{padding:10px}
  .list-item-icon{width:36px; height:36px; font-size:16px}
  
  .sheet-header-content{flex-direction:column; align-items:flex-start; gap:12px}
  .sheet-actions{width:100%; justify-content:stretch}
  .sheet-actions .btn{flex:1}
  .sheet-header{padding:12px 10px}
  .excel-toolbar{padding:10px}
  .excel-filters{flex-direction:column; gap:10px}
  .filter-group{min-width:100%; flex:none}
  .excel-container{max-height:calc(100vh - 320px); font-size:11px}
  .excel-table{font-size:11px}
  .excel-th{padding:8px 6px; font-size:10px}
  .excel-td{padding:8px 6px}
  .excel-th-content{gap:4px}
  .excel-btn{padding:6px 8px; font-size:12px}
  .excel-badge{padding:3px 6px; font-size:9px}
  .sidebar-toggle{top:12px; left:12px; padding:8px 12px; font-size:13px}
  .page{padding:0}
}

/* Item Detail Layout */
.item-detail-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 24px;
  margin-top: 24px;
}

.item-sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: sticky;
  top: 20px;
  align-self: start;
}

.item-cover-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
}

.item-cover-large {
  width: 100%;
  height: auto;
  border-radius: 12px;
  display: block;
  box-shadow: 0 8px 24px rgba(0,0,0,.3);
}

.cover-placeholder {
  width: 100%;
  aspect-ratio: 2/3;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 64px;
  opacity: 0.6;
}

.quick-info-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

.quick-info-row:last-child {
  border-bottom: none;
}

.quick-info-row i {
  width: 20px;
  text-align: center;
  color: var(--accent);
}

.item-main-content {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.detail-row-compact {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.detail-row-compact:last-child {
  border-bottom: none;
}

.detail-label-compact {
  font-size: 14px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.detail-value-compact {
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
}

.notes-textarea {
  width: 100%;
  min-height: 120px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  color: var(--fg);
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  transition: all 0.2s;
}

.notes-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(124,92,255,.1);
}

.notes-status {
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
}

.item-description {
  font-size: 15px;
  line-height: 1.7;
  color: var(--fg);
}

/* Floating AI Chat Button */

@media (max-width: 1024px) {
  .item-detail-layout {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  
  .item-sidebar {
    position: static;
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 16px;
  }
  
  .item-cover-card {
    grid-row: 1 / 3;
  }
  
  .detail-grid {
    grid-template-columns: 1fr;
  }
  
  .floating-chat-btn {
    width: 56px;
    height: 56px;
    font-size: 24px;
    bottom: 24px;
    right: 24px;
  }
}

@media (max-width: 640px) {
  .item-detail-layout {
    gap: 12px;
  }
  
  .item-sidebar {
    grid-template-columns: 1fr;
  }
  
  .item-cover-card {
    grid-row: auto;
  }
  
  .cover-placeholder {
    aspect-ratio: 2/3;
    max-width: 250px;
    margin: 0 auto;
  }
  
  .item-cover-large {
    max-width: 250px;
    margin: 0 auto;
  }
  
  .quick-info-row {
    font-size: 13px;
    padding: 6px 0;
  }
  
  .value-edit-row {
    flex-direction: column;
    gap: 6px;
  }
  
  .value-edit-row input,
  .value-edit-row select,
  .value-edit-row button {
    width: 100% !important;
  }
  
  .notes-textarea {
    min-height: 100px;
    font-size: 13px;
  }
  
  .detail-row-compact {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
  
  .floating-chat-btn {
    width: 52px;
    height: 52px;
    font-size: 22px;
    bottom: 16px;
    right: 16px;
  }
  
  .chat-modal-content {
    width: 95%;
    max-height: 85vh;
  }
}

/* Excel Action Buttons */
.excel-action-group {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
}

.excel-btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: white;
  border: none;
}

.excel-btn-primary:hover {
  opacity: 0.9;
  transform: scale(1.05);
}

.excel-btn-secondary {
  background: var(--panel);
  color: var(--accent);
  border: 1px solid var(--accent);
}

.excel-btn-secondary:hover {
  background: var(--accent);
  color: white;
}

.excel-btn-accent {
  background: rgba(45,226,230,.15);
  color: var(--accent2);
  border: 1px solid var(--accent2);
}

.excel-btn-accent:hover {
  background: var(--accent2);
  color: white;
}

/* Manual Value Input */
.value-edit-row {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.value-edit-row input {
  flex: 1;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 10px;
  color: var(--fg);
  font-size: 13px;
}

.value-edit-row input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(139,107,255,.15);
}

.value-edit-row button {
  padding: 6px 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.2s;
}

.value-edit-row button:hover {
  transform: scale(1.05);
}

.value-edit-row button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.value-display {
  color: var(--success);
  font-weight: 700;
  font-size: 16px;
}

